Package org.jline.terminal.impl.jna.win
Class WindowsAnsiWriter
java.lang.Object
java.io.Writer
java.io.FilterWriter
org.jline.utils.AnsiWriter
org.jline.terminal.impl.jna.win.WindowsAnsiWriter
- All Implemented Interfaces:
Closeable,Flushable,Appendable,AutoCloseable
A Windows ANSI escape processor, uses JNA to access native platform
API's to change the console attributes.
- Since:
- 1.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final short[]private static final short[]private static final shortprivate static final shortprivate static final shortprivate static final shortprivate static final shortprivate booleanprivate final com.sun.jna.Pointerprivate static final shortprivate static final shortprivate static final shortprivate static final shortprivate static final shortprivate final Kernel32.CONSOLE_SCREEN_BUFFER_INFOprivate static final intprivate booleanprivate final shortprivate shortprivate shortprivate booleanFields inherited from class org.jline.utils.AnsiWriter
ATTRIBUTE_BLINK_FAST, ATTRIBUTE_BLINK_OFF, ATTRIBUTE_BLINK_SLOW, ATTRIBUTE_CONCEAL_OFF, ATTRIBUTE_CONCEAL_ON, ATTRIBUTE_INTENSITY_BOLD, ATTRIBUTE_INTENSITY_FAINT, ATTRIBUTE_INTENSITY_NORMAL, ATTRIBUTE_ITALIC, ATTRIBUTE_NEGATIVE_Off, ATTRIBUTE_NEGATIVE_OFF, ATTRIBUTE_NEGATIVE_ON, ATTRIBUTE_UNDERLINE, ATTRIBUTE_UNDERLINE_DOUBLE, ATTRIBUTE_UNDERLINE_OFF, BLACK, BLUE, CYAN, ERASE_LINE, ERASE_LINE_TO_BEGINING, ERASE_LINE_TO_END, ERASE_SCREEN, ERASE_SCREEN_TO_BEGINING, ERASE_SCREEN_TO_END, GREEN, MAGENTA, RED, WHITE, YELLOWFields inherited from class java.io.FilterWriter
out -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidprivate voidprivate voidprivate shortinvertAttributeColors(short attributes) protected voidprocessSGR 0corresponding toReset / Normalprotected voidprocessChangeWindowTitle(String label) processOSC 2;text BELcorresponding toChange Window titleprotected voidprocessCursorDown(int count) processCSI n Bcorresponding toCUD – Cursor Downprotected voidprocessCursorDownLine(int count) processCSI n Ecorresponding toCNL – Cursor Next Lineprotected voidprocessCursorLeft(int count) processCSI n Dcorresponding toCUB – Cursor Backprotected voidprocessCursorRight(int count) processCSI n Ccorresponding toCUF – Cursor Forwardprotected voidprocessCursorTo(int row, int col) processCSI n ; m Hcorresponding toCUP – Cursor PositionorCSI n ; m fcorresponding toHVP – Horizontal and Vertical Positionprotected voidprocessCursorToColumn(int x) processCSI n Gcorresponding toCHA – Cursor Horizontal Absoluteprotected voidprocessCursorUp(int count) processCSI n Acorresponding toCUU – Cursor Upprotected voidprocessCursorUpLine(int count) processCSI n Fcorresponding toCPL – Cursor Previous Lineprotected voidprocessSGR 49corresponding toDefault background colorprotected voidprocessSGR 39corresponding toDefault text color (foreground)protected voidprocessDeleteLine(int optionInt) ProcessCSI sANSI code, corresponding toDL – Delete Lineprotected voidprocessEraseLine(int eraseOption) ProcessCSI n KANSI code, corresponding toED – Erase in Lineprotected voidprocessEraseScreen(int eraseOption) ProcessCSI n JANSI code, corresponding toED – Erase in Displayprotected voidprocessInsertLine(int optionInt) ProcessCSI sANSI code, corresponding toIL – Insert Lineprotected voidProcessCSI uANSI code, corresponding toRCP – Restore Cursor Positionprotected voidProcessCSI sANSI code, corresponding toSCP – Save Cursor Positionprotected voidprocessSetAttribute(int attribute) processSGRother than0(reset),30-39(foreground),40-49(background),90-97(foreground high intensity) or100-107(background high intensity)protected voidprocessSetBackgroundColorExt(int paletteIndex) processSGR 48corresponding toextended set background colorwith a palette of 255 colors.protected voidprocessSetForegroundColorExt(int paletteIndex) processSGR 38corresponding toextended set text color (foreground)with a palette of 255 colors.Methods inherited from class org.jline.utils.AnsiWriter
close, processChangeIconName, processChangeIconNameAndWindowTitle, processCharsetSelect, processScrollDown, processScrollUp, processSetBackgroundColor, processSetBackgroundColor, processSetBackgroundColorExt, processSetForegroundColor, processSetForegroundColor, processSetForegroundColorExt, processUnknownExtension, processUnknownOperatingSystemCommand, write, write, writeMethods inherited from class java.io.FilterWriter
flush
-
Field Details
-
FOREGROUND_BLACK
private static final short FOREGROUND_BLACK- See Also:
-
FOREGROUND_YELLOW
private static final short FOREGROUND_YELLOW- See Also:
-
FOREGROUND_MAGENTA
private static final short FOREGROUND_MAGENTA- See Also:
-
FOREGROUND_CYAN
private static final short FOREGROUND_CYAN- See Also:
-
FOREGROUND_WHITE
private static final short FOREGROUND_WHITE- See Also:
-
BACKGROUND_BLACK
private static final short BACKGROUND_BLACK- See Also:
-
BACKGROUND_YELLOW
private static final short BACKGROUND_YELLOW- See Also:
-
BACKGROUND_MAGENTA
private static final short BACKGROUND_MAGENTA- See Also:
-
BACKGROUND_CYAN
private static final short BACKGROUND_CYAN- See Also:
-
BACKGROUND_WHITE
private static final short BACKGROUND_WHITE- See Also:
-
ANSI_FOREGROUND_COLOR_MAP
private static final short[] ANSI_FOREGROUND_COLOR_MAP -
ANSI_BACKGROUND_COLOR_MAP
private static final short[] ANSI_BACKGROUND_COLOR_MAP -
MAX_ESCAPE_SEQUENCE_LENGTH
private static final int MAX_ESCAPE_SEQUENCE_LENGTH- See Also:
-
console
private final com.sun.jna.Pointer console -
info
-
originalColors
private final short originalColors -
negative
private boolean negative -
bold
private boolean bold -
underline
private boolean underline -
savedX
private short savedX -
savedY
private short savedY
-
-
Constructor Details
-
WindowsAnsiWriter
- Throws:
IOException
-
-
Method Details
-
getConsoleInfo
- Throws:
IOException
-
applyAttribute
- Throws:
IOException
-
invertAttributeColors
private short invertAttributeColors(short attributes) -
applyCursorPosition
- Throws:
IOException
-
processEraseScreen
Description copied from class:AnsiWriterProcessCSI n JANSI code, corresponding toED – Erase in Display- Overrides:
processEraseScreenin classAnsiWriter- Parameters:
eraseOption- the erase option- Throws:
IOException- if an error occurs
-
processEraseLine
Description copied from class:AnsiWriterProcessCSI n KANSI code, corresponding toED – Erase in Line- Overrides:
processEraseLinein classAnsiWriter- Parameters:
eraseOption- the erase option- Throws:
IOException- if an error occurs
-
processCursorUpLine
Description copied from class:AnsiWriterprocessCSI n Fcorresponding toCPL – Cursor Previous Line- Overrides:
processCursorUpLinein classAnsiWriter- Parameters:
count- line count- Throws:
IOException- if an error occurs
-
processCursorDownLine
Description copied from class:AnsiWriterprocessCSI n Ecorresponding toCNL – Cursor Next Line- Overrides:
processCursorDownLinein classAnsiWriter- Parameters:
count- line count- Throws:
IOException- if an error occurs
-
processCursorLeft
Description copied from class:AnsiWriterprocessCSI n Dcorresponding toCUB – Cursor Back- Overrides:
processCursorLeftin classAnsiWriter- Parameters:
count- the count- Throws:
IOException- if an error occurs
-
processCursorRight
Description copied from class:AnsiWriterprocessCSI n Ccorresponding toCUF – Cursor Forward- Overrides:
processCursorRightin classAnsiWriter- Parameters:
count- the count- Throws:
IOException- if an error occurs
-
processCursorDown
Description copied from class:AnsiWriterprocessCSI n Bcorresponding toCUD – Cursor Down- Overrides:
processCursorDownin classAnsiWriter- Parameters:
count- the count- Throws:
IOException- if an error occurs
-
processCursorUp
Description copied from class:AnsiWriterprocessCSI n Acorresponding toCUU – Cursor Up- Overrides:
processCursorUpin classAnsiWriter- Parameters:
count- the count- Throws:
IOException- if an error occurs
-
processCursorTo
Description copied from class:AnsiWriterprocessCSI n ; m Hcorresponding toCUP – Cursor PositionorCSI n ; m fcorresponding toHVP – Horizontal and Vertical Position- Overrides:
processCursorToin classAnsiWriter- Parameters:
row- the rowcol- the column- Throws:
IOException- if an error occurs
-
processCursorToColumn
Description copied from class:AnsiWriterprocessCSI n Gcorresponding toCHA – Cursor Horizontal Absolute- Overrides:
processCursorToColumnin classAnsiWriter- Parameters:
x- the column- Throws:
IOException- if an error occurs
-
processSetForegroundColorExt
Description copied from class:AnsiWriterprocessSGR 38corresponding toextended set text color (foreground)with a palette of 255 colors.- Overrides:
processSetForegroundColorExtin classAnsiWriter- Parameters:
paletteIndex- the text color in the palette- Throws:
IOException- if an error occurs
-
processSetBackgroundColorExt
Description copied from class:AnsiWriterprocessSGR 48corresponding toextended set background colorwith a palette of 255 colors.- Overrides:
processSetBackgroundColorExtin classAnsiWriter- Parameters:
paletteIndex- the background color in the palette- Throws:
IOException- if an error occurs
-
processDefaultTextColor
Description copied from class:AnsiWriterprocessSGR 39corresponding toDefault text color (foreground)- Overrides:
processDefaultTextColorin classAnsiWriter- Throws:
IOException- if an error occurs
-
processDefaultBackgroundColor
Description copied from class:AnsiWriterprocessSGR 49corresponding toDefault background color- Overrides:
processDefaultBackgroundColorin classAnsiWriter- Throws:
IOException- if an error occurs
-
processAttributeRest
Description copied from class:AnsiWriterprocessSGR 0corresponding toReset / Normal- Overrides:
processAttributeRestin classAnsiWriter- Throws:
IOException- if an error occurs
-
processSetAttribute
Description copied from class:AnsiWriterprocessSGRother than0(reset),30-39(foreground),40-49(background),90-97(foreground high intensity) or100-107(background high intensity)- Overrides:
processSetAttributein classAnsiWriter- Parameters:
attribute- the attribute to set- Throws:
IOException- if an error occurs- See Also:
-
processSaveCursorPosition
Description copied from class:AnsiWriterProcessCSI sANSI code, corresponding toSCP – Save Cursor Position- Overrides:
processSaveCursorPositionin classAnsiWriter- Throws:
IOException- if an error occurs
-
processRestoreCursorPosition
Description copied from class:AnsiWriterProcessCSI uANSI code, corresponding toRCP – Restore Cursor Position- Overrides:
processRestoreCursorPositionin classAnsiWriter- Throws:
IOException- if an error occurs
-
processInsertLine
Description copied from class:AnsiWriterProcessCSI sANSI code, corresponding toIL – Insert Line- Overrides:
processInsertLinein classAnsiWriter- Parameters:
optionInt- the option- Throws:
IOException- if an error occurs
-
processDeleteLine
Description copied from class:AnsiWriterProcessCSI sANSI code, corresponding toDL – Delete Line- Overrides:
processDeleteLinein classAnsiWriter- Parameters:
optionInt- the option- Throws:
IOException- if an error occurs
-
processChangeWindowTitle
Description copied from class:AnsiWriterprocessOSC 2;text BELcorresponding toChange Window title- Overrides:
processChangeWindowTitlein classAnsiWriter- Parameters:
label- the title
-