Class InBandResize
When mode 2048 is active, the terminal sends
CSI 48 ; rows ; cols ; pixelHeight ; pixelWidth t whenever the
window is resized. The KeyMap binding consumes the
CSI 48 ; prefix (RESIZE_SEQ); the methods in this class
handle the remainder of the sequence.
This was originally implemented inside
org.jline.reader.impl.LineReaderImpl but is extracted here so that
full-screen builtins (Nano, Less, Tmux) ? which
bypass LineReader and read input directly via
BindingReader ? can also handle in-band resize reports.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe CSI prefix that starts an in-band resize report. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidapplyResizeParams(String params, Terminal terminal) Parsesrows;cols[;pixelHeight;pixelWidth]and applies the new terminal size, raisingTerminal.Signal.WINCH.static voidhandleResize(BindingReader reader, Terminal terminal) Convenience method that reads and applies an in-band resize report in a single call.static StringreadResizeParams(BindingReader reader) Reads resize parameters from the input until the finaltbyte.
-
Field Details
-
RESIZE_SEQ
-
-
Method Details
-
readResizeParams
Reads resize parameters from the input until the finaltbyte.The
KeyMapmatch has already consumed theRESIZE_SEQprefix. This method reads the remaining characters ? digits and semicolons formingrows;cols[;pixelHeight;pixelWidth]? up to the terminatingt.- Parameters:
reader- the binding reader to read characters from- Returns:
- the parameter string (e.g.
"24;80"), ornullif the sequence is malformed or too long
-
applyResizeParams
Parsesrows;cols[;pixelHeight;pixelWidth]and applies the new terminal size, raisingTerminal.Signal.WINCH.The pixel dimensions (if present) are currently ignored ? only the character-cell dimensions are applied. Rows and columns that exceed the built-in safety bounds (1000 rows, 5000 columns) are silently rejected to prevent unsafe redraw allocations.
- Parameters:
params- the parameter string returned byreadResizeParams(BindingReader)terminal- the terminal whose size should be updated
-
handleResize
Convenience method that reads and applies an in-band resize report in a single call.- Parameters:
reader- the binding reader to read characters fromterminal- the terminal whose size should be updated
-