Class Less
java.lang.Object
org.jline.builtins.Less
A 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 -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final org.jline.keymap.BindingReaderprotected final StringBuilderbooleanprotected final Pathprotected Stringprotected final org.jline.utils.Displayprotected Stringprotected Stringprotected intprotected intprotected intprotected intprotected Sourcebooleanbooleanprotected org.jline.keymap.KeyMap<Less.Operation> protected List<org.jline.utils.AttributedString> protected Stringprotected intbooleanbooleanprotected intprotected final Map<String, Less.Operation> protected Stringprotected Nano.PatternHistorybooleanbooleanbooleanbooleanbooleanprotected BufferedReaderprotected org.jline.terminal.Sizeprotected intprotected Stringprotected final org.jline.terminal.Terminalbooleanprotected int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidThis is for long running commands to be interrupted by ctrl-cdefaultPrompt(String prompt) Sets a custom default prompt string displayed at the bottom of the screen when no message is active.voidhandle(org.jline.terminal.Terminal.Signal signal) helpSource(Source helpSource) Sets a custom help source displayed when the user presseshorH.protected voidvoidvoidstatic String[]usage()
-
Field Details
-
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
-
syntaxName
-
defaultPrompt
-
helpSource
-
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
-
sources
-
sourceIdx
protected int sourceIdx -
reader
-
keys
-
firstLineInMemory
protected int firstLineInMemory -
lines
-
firstLineToDisplay
protected int firstLineToDisplay -
firstColumnToDisplay
protected int firstColumnToDisplay -
offsetInLine
protected int offsetInLine -
message
-
errorMessage
-
buffer
-
options
-
window
protected int window -
halfWindow
protected int halfWindow -
nbEof
protected int nbEof -
patternHistory
-
pattern
-
displayPattern
-
size
protected volatile org.jline.terminal.Size size
-
-
Constructor Details
-
Less
-
Less
-
Less
public Less(org.jline.terminal.Terminal terminal, Path currentDir, Options opts, ConfigurationPath configPath)
-
-
Method Details
-
usage
-
tabs
-
defaultPrompt
Sets a custom default prompt string displayed at the bottom of the screen when no message is active. If not set, the default":"is shown. The prompt is rendered with inverse video style.- Parameters:
prompt- the prompt string to display- Returns:
- this
Lessinstance for chaining
-
helpSource
Sets a custom help source displayed when the user presseshorH. If not set, the built-inless-help.txtresource is shown. This is useful for applications that embed Less and want to provide context-specific help text instead of the default help, which references command-line options and uses the term "LESS".- Parameters:
helpSource- aSourceproviding the custom help content- Returns:
- this
Lessinstance for chaining
-
handle
public void handle(org.jline.terminal.Terminal.Signal signal) -
run
- Throws:
IOExceptionInterruptedException
-
run
- Throws:
IOExceptionInterruptedException
-
openSource
- Throws:
IOException
-
checkInterrupted
This is for long running commands to be interrupted by ctrl-c- Throws:
InterruptedException- if the thread has been interruped
-