Class InBandResize
- java.lang.Object
-
- org.jline.keymap.InBandResize
-
public final class InBandResize extends java.lang.ObjectShared utility for handling DEC private mode 2048 (in-band window resize notifications).When mode 2048 is active, the terminal sends
CSI 48 ; rows ; cols ; pixelHeight ; pixelWidth twhenever the window is resized. TheKeyMapbinding consumes theCSI 48 ;prefix (RESIZE_SEQ); the methods in this class handle the remainder of the sequence.This was originally implemented inside
org.jline.reader.impl.LineReaderImplbut is extracted here so that full-screen builtins (Nano,Less,Tmux) ? which bypassLineReaderand read input directly viaBindingReader? can also handle in-band resize reports.- See Also:
Terminal.trackInBandResize(boolean)
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringRESIZE_SEQThe CSI prefix that starts an in-band resize report.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidapplyResizeParams(java.lang.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 java.lang.StringreadResizeParams(BindingReader reader)Reads resize parameters from the input until the finaltbyte.
-
-
-
Field Detail
-
RESIZE_SEQ
public static final java.lang.String RESIZE_SEQ
The CSI prefix that starts an in-band resize report. Bind this in aKeyMapto trigger resize handling.- See Also:
- Constant Field Values
-
-
Method Detail
-
readResizeParams
public static java.lang.String readResizeParams(BindingReader reader)
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
public static void applyResizeParams(java.lang.String params, Terminal terminal)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(org.jline.keymap.BindingReader)terminal- the terminal whose size should be updated
-
handleResize
public static void handleResize(BindingReader reader, Terminal terminal)
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
-
-