Package org.jline.builtins
Class Less
- java.lang.Object
-
- org.jline.builtins.Less
-
public class Less extends java.lang.ObjectA terminal pager similar to the 'less' Unix command.This class provides a file viewer with features including:
- Forward and backward navigation
- Search functionality
- Syntax highlighting
- Line numbering
- Status display
- Multiple file support
The implementation supports many of the key bindings and features of the traditional Unix 'less' command, adapted for JLine's terminal handling.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classLess.Operation
-
Field Summary
Fields Modifier and Type Field Description protected org.jline.keymap.BindingReaderbindingReaderprotected java.lang.StringBuilderbufferbooleanchopLongLinesprotected java.nio.file.PathcurrentDirprotected org.jline.utils.Displaydisplayprotected java.lang.StringdisplayPatternprotected java.lang.StringerrorMessageprotected intfirstColumnToDisplayprotected intfirstLineInMemoryprotected intfirstLineToDisplayprotected inthalfWindowbooleanignoreCaseAlwaysbooleanignoreCaseCondprotected org.jline.keymap.KeyMap<Less.Operation>keysprotected java.util.List<org.jline.utils.AttributedString>linesprotected java.lang.Stringmessageprotected intnbEofbooleannoInitbooleannoKeypadprotected intoffsetInLineprotected java.util.Map<java.lang.String,Less.Operation>optionsprotected java.lang.Stringpatternprotected Nano.PatternHistorypatternHistorybooleanprintLineNumbersbooleanquietbooleanquitAtFirstEofbooleanquitAtSecondEofbooleanquitIfOneScreenprotected java.io.BufferedReaderreaderprotected org.jline.terminal.Sizesizeprotected intsourceIdxprotected java.util.List<Source>sourcesprotected java.lang.StringsyntaxNameprotected java.util.List<java.lang.Integer>tabsprotected org.jline.terminal.TerminalterminalbooleanveryQuietprotected intwindow
-
Constructor Summary
Constructors Constructor Description Less(org.jline.terminal.Terminal terminal, java.nio.file.Path currentDir)Less(org.jline.terminal.Terminal terminal, java.nio.file.Path currentDir, Options opts)Less(org.jline.terminal.Terminal terminal, java.nio.file.Path currentDir, Options opts, ConfigurationPath configPath)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static voidcheckInterrupted()This is for long running commands to be interrupted by ctrl-cvoidhandle(org.jline.terminal.Terminal.Signal signal)protected voidopenSource()voidrun(java.util.List<Source> sources)voidrun(Source... sources)Lesstabs(java.util.List<java.lang.Integer> tabs)static java.lang.String[]usage()
-
-
-
Field Detail
-
quitAtSecondEof
public boolean quitAtSecondEof
-
quitAtFirstEof
public boolean quitAtFirstEof
-
quitIfOneScreen
public boolean quitIfOneScreen
-
printLineNumbers
public boolean printLineNumbers
-
quiet
public boolean quiet
-
veryQuiet
public boolean veryQuiet
-
chopLongLines
public boolean chopLongLines
-
ignoreCaseCond
public boolean ignoreCaseCond
-
ignoreCaseAlways
public boolean ignoreCaseAlways
-
noKeypad
public boolean noKeypad
-
noInit
public boolean noInit
-
tabs
protected java.util.List<java.lang.Integer> tabs
-
syntaxName
protected java.lang.String syntaxName
-
terminal
protected final org.jline.terminal.Terminal terminal
-
display
protected final org.jline.utils.Display display
-
bindingReader
protected final org.jline.keymap.BindingReader bindingReader
-
currentDir
protected final java.nio.file.Path currentDir
-
sources
protected java.util.List<Source> sources
-
sourceIdx
protected int sourceIdx
-
reader
protected java.io.BufferedReader reader
-
keys
protected org.jline.keymap.KeyMap<Less.Operation> keys
-
firstLineInMemory
protected int firstLineInMemory
-
lines
protected java.util.List<org.jline.utils.AttributedString> lines
-
firstLineToDisplay
protected int firstLineToDisplay
-
firstColumnToDisplay
protected int firstColumnToDisplay
-
offsetInLine
protected int offsetInLine
-
message
protected java.lang.String message
-
errorMessage
protected java.lang.String errorMessage
-
buffer
protected final java.lang.StringBuilder buffer
-
options
protected final java.util.Map<java.lang.String,Less.Operation> options
-
window
protected int window
-
halfWindow
protected int halfWindow
-
nbEof
protected int nbEof
-
patternHistory
protected Nano.PatternHistory patternHistory
-
pattern
protected java.lang.String pattern
-
displayPattern
protected java.lang.String displayPattern
-
size
protected final org.jline.terminal.Size size
-
-
Constructor Detail
-
Less
public Less(org.jline.terminal.Terminal terminal, java.nio.file.Path currentDir)
-
Less
public Less(org.jline.terminal.Terminal terminal, java.nio.file.Path currentDir, Options opts)
-
Less
public Less(org.jline.terminal.Terminal terminal, java.nio.file.Path currentDir, Options opts, ConfigurationPath configPath)
-
-
Method Detail
-
usage
public static java.lang.String[] usage()
-
tabs
public Less tabs(java.util.List<java.lang.Integer> tabs)
-
handle
public void handle(org.jline.terminal.Terminal.Signal signal)
-
run
public void run(Source... sources) throws java.io.IOException, java.lang.InterruptedException
- Throws:
java.io.IOExceptionjava.lang.InterruptedException
-
run
public void run(java.util.List<Source> sources) throws java.io.IOException, java.lang.InterruptedException
- Throws:
java.io.IOExceptionjava.lang.InterruptedException
-
openSource
protected void openSource() throws java.io.IOException- Throws:
java.io.IOException
-
checkInterrupted
public static void checkInterrupted() throws java.lang.InterruptedExceptionThis is for long running commands to be interrupted by ctrl-c- Throws:
java.lang.InterruptedException- if the thread has been interruped
-
-