Class TerminalTextBuffer
java.lang.Object
org.springframework.shell.test.jediterm.terminal.model.TerminalTextBuffer
Buffer for storing styled text data.
Stores only text that fit into one screen XxY, but has scrollBuffer to save history lines and screenBuffer to restore
screen after resize. ScrollBuffer stores all lines before the first line currently shown on the screen. TextBuffer
stores lines that are shown currently on the screen and they have there(in TextBuffer) their initial length (even if
it doesn't fit to screen width).
-
Constructor Summary
ConstructorDescriptionTerminalTextBuffer
(int width, int height, StyleState styleState) TerminalTextBuffer
(int width, int height, StyleState styleState, int historyLinesCount) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addLine
(TerminalLine line) void
addModelListener
(TerminalModelListener listener) void
void
clearAll()
void
void
clearLines
(int startRow, int endRow) void
void
deleteCharacters
(int x, int y, int count) deleteLines
(int y, int count, int scrollRegionBottom) void
eraseCharacters
(int leftX, int rightX, int y) int
char
getBuffersCharAt
(int x, int y) char
getCharAt
(int x, int y) int
int
getLine
(int index) Returns terminal lines.int
getStyleAt
(int x, int y) getStyledCharAt
(int x, int y) int
getWidth()
void
insertBlankCharacters
(int x, int y, int count) void
insertLines
(int y, int count, int scrollRegionBottom) boolean
void
lock()
void
processHistoryAndScreenLines
(int scrollOrigin, int maximalLinesToProcess, StyledTextConsumer consumer) void
processScreenLines
(int yStart, int yCount, StyledTextConsumer consumer) void
removeModelListener
(TerminalModelListener listener) void
void
scrollArea
(int scrollRegionTop, int dy, int scrollRegionBottom) boolean
tryLock()
void
unlock()
void
useAlternateBuffer
(boolean enabled) void
writeString
(int x, int y, CharBuffer str)
-
Constructor Details
-
TerminalTextBuffer
-
TerminalTextBuffer
-
-
Method Details
-
addModelListener
-
addTypeAheadModelListener
-
removeModelListener
-
removeTypeAheadModelListener
-
deleteCharacters
public void deleteCharacters(int x, int y, int count) -
insertBlankCharacters
public void insertBlankCharacters(int x, int y, int count) -
writeString
-
addLine
-
scrollArea
public void scrollArea(int scrollRegionTop, int dy, int scrollRegionBottom) -
getStyleLines
-
getLine
Returns terminal lines. Negative indexes are for history buffer. Non-negative for screen buffer.- Parameters:
index
- index of line- Returns:
- history lines for index<0, screen line for index>=0
-
getScreen
-
processScreenLines
-
lock
public void lock() -
unlock
public void unlock() -
tryLock
public boolean tryLock() -
getWidth
public int getWidth() -
getHeight
public int getHeight() -
getHistoryLinesCount
public int getHistoryLinesCount() -
getScreenLinesCount
public int getScreenLinesCount() -
getBuffersCharAt
public char getBuffersCharAt(int x, int y) -
getStyleAt
-
getStyledCharAt
-
getCharAt
public char getCharAt(int x, int y) -
isUsingAlternateBuffer
public boolean isUsingAlternateBuffer() -
useAlternateBuffer
public void useAlternateBuffer(boolean enabled) -
getHistoryBuffer
-
insertLines
public void insertLines(int y, int count, int scrollRegionBottom) -
deleteLines
-
clearLines
public void clearLines(int startRow, int endRow) -
eraseCharacters
public void eraseCharacters(int leftX, int rightX, int y) -
clearAll
public void clearAll() -
processHistoryAndScreenLines
public void processHistoryAndScreenLines(int scrollOrigin, int maximalLinesToProcess, StyledTextConsumer consumer) - Parameters:
scrollOrigin
- row where a scrolling window starts, should be in the range [-history_lines_count, 0]
-
clearHistory
public void clearHistory() -
findScreenLineIndex
-
clearTypeAheadPredictions
public void clearTypeAheadPredictions()
-