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 BindingReaderbindingReaderprotected java.lang.StringBuilderbufferbooleanchopLongLinesprotected java.nio.file.PathcurrentDirprotected Displaydisplayprotected java.lang.StringdisplayPatternprotected java.lang.StringerrorMessageprotected intfirstColumnToDisplayprotected intfirstLineInMemoryprotected intfirstLineToDisplayprotected inthalfWindowbooleanignoreCaseAlwaysbooleanignoreCaseCondprotected KeyMap<Less.Operation>keysprotected java.util.List<AttributedString>linesprotected java.lang.Stringmessageprotected intnbEofbooleannoInitbooleannoKeypadprotected intoffsetInLineprotected java.util.Map<java.lang.String,Less.Operation>optionsprotected java.lang.Stringpatternprotected Nano.PatternHistorypatternHistorybooleanprintLineNumbersbooleanquietbooleanquitAtFirstEofbooleanquitAtSecondEofbooleanquitIfOneScreenprotected java.io.BufferedReaderreaderprotected Sizesizeprotected intsourceIdxprotected java.util.List<Source>sourcesprotected java.lang.StringsyntaxNameprotected java.util.List<java.lang.Integer>tabsprotected TerminalterminalbooleanveryQuietprotected intwindow
-
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(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 Terminal terminal
-
display
protected final Display display
-
bindingReader
protected final 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 KeyMap<Less.Operation> keys
-
firstLineInMemory
protected int firstLineInMemory
-
lines
protected java.util.List<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 Size size
-
-
Method Detail
-
usage
public static java.lang.String[] usage()
-
tabs
public Less tabs(java.util.List<java.lang.Integer> tabs)
-
handle
public void handle(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
-
-