Package org.aesh.readline
Interface ConsoleBuffer
- All Known Implementing Classes:
AeshConsoleBuffer
public interface ConsoleBuffer
Internal class for actions to get access to the buffer, history, connection, ++
- Author:
- Ståle W. Pedersen
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidAccept the currently displayed ghost text into the buffer.default voidAccept the next word from the currently displayed ghost text into the buffer.voidWill add the current action to the undo stackbuffer()Get the input buffer containing the current line being edited.voidChange case on the char located at the cursor positionvoidclear(boolean includeBuffer) Clear an ansi terminal.default voidClear any currently displayed ghost text from the terminal.Get the completion handler for tab completion.voiddelete(int delta) Delete from cursor position back or forth depending on the value of delta.voiddownCase()Down case the char located at the cursor positionvoiddrawLine()Print the contents of the current buffer to the consolevoidForce a rewrite of the prompt even though it might not be neededdefault StringGet the currently displayed ghost text.history()Get the command history manager.voidinsert(int[] insert) Insert at the end of the BuffervoidInsert a String into the buffer at a specific pointvoidmoveCursor(int where) Move the cursor either back or forth.Get the paste manager for copy/paste operations.voidreplace(int[] line) Replace the entire current buffer with the given line The new line will be pushed to the Connection Cursor will be moved to the end of the new buffer linevoidReplace the entire current buffer with the given line The new line will be pushed to the Connection Cursor will be moved to the end of the new buffer linevoidreset()Clear all content in the Buffer and reset all datavoidSpecify the promptvoidSet the terminal size.default voidshowGhostText(String suggestion) Display ghost text (dimmed inline suggestion) after the cursor.size()Get the current terminal size.Get the undo manager for undo/redo operations.voidupCase()Up case the char located at the cursor positionvoidwriteChar(char input) Write a single character to the buffer.voidwriteChars(int[] input) Write code points to the buffer.voidwriteOut(int[] out) Write code points directly to the connection output stream.voidWrite a string directly to the connection output stream.voidwriteString(String input) Write a string to the buffer.
-
Method Details
-
history
History history()Get the command history manager.- Returns:
- the history manager
-
completer
CompletionHandler completer()Get the completion handler for tab completion.- Returns:
- the completion handler
-
setSize
Set the terminal size.- Parameters:
size- the new terminal size
-
size
Size size()Get the current terminal size.- Returns:
- the terminal size
-
buffer
Buffer buffer()Get the input buffer containing the current line being edited.- Returns:
- the input buffer
-
undoManager
UndoManager undoManager()Get the undo manager for undo/redo operations.- Returns:
- the undo manager
-
addActionToUndoStack
void addActionToUndoStack()Will add the current action to the undo stack -
pasteManager
PasteManager pasteManager()Get the paste manager for copy/paste operations.- Returns:
- the paste manager
-
moveCursor
void moveCursor(int where) Move the cursor either back or forth. Boundary checks will be done to make sure that the cursor do not go OB.- Parameters:
where- < 0 move back, where > 0 move forward
-
drawLine
void drawLine()Print the contents of the current buffer to the console -
drawLineForceDisplay
void drawLineForceDisplay()Force a rewrite of the prompt even though it might not be needed -
writeChar
void writeChar(char input) Write a single character to the buffer.- Parameters:
input- the character to write
-
writeOut
Write a string directly to the connection output stream.- Parameters:
out- the string to write
-
writeOut
void writeOut(int[] out) Write code points directly to the connection output stream.- Parameters:
out- the code points to write
-
writeChars
void writeChars(int[] input) Write code points to the buffer.- Parameters:
input- the code points to write
-
writeString
Write a string to the buffer.- Parameters:
input- the string to write
-
setPrompt
Specify the prompt- Parameters:
prompt- new prompt
-
insert
Insert a String into the buffer at a specific point- Parameters:
insert- inputposition- point in the buffer
-
insert
void insert(int[] insert) Insert at the end of the Buffer- Parameters:
insert- data
-
delete
void delete(int delta) Delete from cursor position back or forth depending on the value of delta. Delta < 0 delete backwards, delta > 0 delete forwards.- Parameters:
delta- specify which direction and how far to delete
-
upCase
void upCase()Up case the char located at the cursor position -
downCase
void downCase()Down case the char located at the cursor position -
changeCase
void changeCase()Change case on the char located at the cursor position -
replace
void replace(int[] line) Replace the entire current buffer with the given line The new line will be pushed to the Connection Cursor will be moved to the end of the new buffer line- Parameters:
line- input
-
replace
Replace the entire current buffer with the given line The new line will be pushed to the Connection Cursor will be moved to the end of the new buffer line- Parameters:
line- input
-
reset
void reset()Clear all content in the Buffer and reset all data -
clear
void clear(boolean includeBuffer) Clear an ansi terminal. Set includeBuffer to true if the current buffer should be printed again after clear.- Parameters:
includeBuffer- if true include the current buffer line
-
clearGhostText
default void clearGhostText()Clear any currently displayed ghost text from the terminal. -
showGhostText
Display ghost text (dimmed inline suggestion) after the cursor.- Parameters:
suggestion- the suggestion suffix to display
-
acceptGhostText
default void acceptGhostText()Accept the currently displayed ghost text into the buffer. -
acceptGhostTextWord
default void acceptGhostTextWord()Accept the next word from the currently displayed ghost text into the buffer. The remaining ghost text continues to be displayed. -
getGhostText
Get the currently displayed ghost text.- Returns:
- the ghost text, or null if none
-