Package org.jline.terminal.impl.jna.win
Class JnaWinSysTerminal
java.lang.Object
org.jline.terminal.impl.AbstractTerminal
org.jline.terminal.impl.AbstractWindowsTerminal
org.jline.terminal.impl.jna.win.JnaWinSysTerminal
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable,Terminal
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.jline.terminal.Terminal
Terminal.MouseTracking, Terminal.Signal, Terminal.SignalHandler -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final com.sun.jna.Pointerprivate static final com.sun.jna.Pointerprivate final com.sun.jna.ptr.IntByReferenceprivate char[]private final Kernel32.INPUT_RECORD[]private char[]Fields inherited from class org.jline.terminal.impl.AbstractWindowsTerminal
attributes, closer, ENABLE_ECHO_INPUT, ENABLE_INSERT_MODE, ENABLE_LINE_INPUT, ENABLE_MOUSE_INPUT, ENABLE_PROCESSED_INPUT, ENABLE_QUICK_EDIT_MODE, ENABLE_VIRTUAL_TERMINAL_PROCESSING, ENABLE_WINDOW_INPUT, focusTracking, input, lock, nativeHandlers, originalConsoleMode, output, paused, pump, reader, slaveInputPipe, tracking, TYPE_WINDOWS, TYPE_WINDOWS_256_COLOR, TYPE_WINDOWS_CONEMU, TYPE_WINDOWS_VTP, writerFields inherited from class org.jline.terminal.impl.AbstractTerminal
bools, encoding, handlers, ints, name, onClose, palette, status, strings, typeFields inherited from interface org.jline.terminal.Terminal
TYPE_DUMB, TYPE_DUMB_COLOR -
Constructor Summary
ConstructorsConstructorDescriptionJnaWinSysTerminal(Writer writer, String name, String type, Charset encoding, int codepage, boolean nativeSignals, Terminal.SignalHandler signalHandler) -
Method Summary
Modifier and TypeMethodDescriptionstatic JnaWinSysTerminalcreateTerminal(String name, String type, boolean ansiPassThrough, Charset encoding, int codepage, boolean nativeSignals, Terminal.SignalHandler signalHandler, boolean paused) Retrieve the size of the window buffer.protected intgetCursorPosition(IntConsumer discarded) Query the terminal to report the cursor position.getSize()Retrieve the size of the visible windowstatic booleanstatic booleanstatic booleanprotected booleanRead a single input event from the input buffer and process it.private voidprocessFocusEvent(boolean hasFocus) private voidprocessKeyEvent(Kernel32.KEY_EVENT_RECORD keyEvent) private voidprocessMouseEvent(Kernel32.MOUSE_EVENT_RECORD mouseEvent) private Kernel32.INPUT_RECORDreadConsoleInput(int dwMilliseconds) protected voidsetConsoleMode(int mode) Methods inherited from class org.jline.terminal.impl.AbstractWindowsTerminal
canPauseResume, ctrl, doClose, getAttributes, getEscapeSequence, getRawSequence, handle, hasFocusSupport, input, output, pause, pause, paused, processInputChar, processKeyEvent, pump, reader, resume, setAttributes, setSize, trackFocus, trackMouse, updateConsoleMode, writerMethods inherited from class org.jline.terminal.impl.AbstractTerminal
checkInterrupted, close, echo, echo, echoSignal, encoding, enterRawMode, flush, getBooleanCapability, getKind, getName, getNumericCapability, getPalette, getStatus, getStatus, getStringCapability, getType, hasMouseSupport, parseInfoCmp, puts, raise, readMouseEvent, readMouseEvent, setOnClose
-
Field Details
-
consoleIn
private static final com.sun.jna.Pointer consoleIn -
consoleOut
private static final com.sun.jna.Pointer consoleOut -
focus
private char[] focus -
mouse
private char[] mouse -
inputEvents
-
eventsRead
private final com.sun.jna.ptr.IntByReference eventsRead
-
-
Constructor Details
-
JnaWinSysTerminal
JnaWinSysTerminal(Writer writer, String name, String type, Charset encoding, int codepage, boolean nativeSignals, Terminal.SignalHandler signalHandler) throws IOException - Throws:
IOException
-
-
Method Details
-
createTerminal
public static JnaWinSysTerminal createTerminal(String name, String type, boolean ansiPassThrough, Charset encoding, int codepage, boolean nativeSignals, Terminal.SignalHandler signalHandler, boolean paused) throws IOException - Throws:
IOException
-
isWindowsConsole
public static boolean isWindowsConsole() -
isConsoleOutput
public static boolean isConsoleOutput() -
isConsoleInput
public static boolean isConsoleInput() -
getConsoleMode
protected int getConsoleMode()- Specified by:
getConsoleModein classAbstractWindowsTerminal
-
setConsoleMode
protected void setConsoleMode(int mode) - Specified by:
setConsoleModein classAbstractWindowsTerminal
-
getSize
Description copied from interface:TerminalRetrieve the size of the visible window- Returns:
- the visible terminal size
- See Also:
-
getBufferSize
Description copied from interface:TerminalRetrieve the size of the window buffer. Some terminals can be configured to have a buffer size larger than the visible window size and provide scroll bars. In such cases, this method should attempt to return the size of the whole buffer. ThegetBufferSize()method can be used to avoid wrapping when using the terminal in a line editing mode, while theTerminal.getSize()method should be used when using full screen mode.- Returns:
- the terminal buffer size
- See Also:
-
processConsoleInput
Description copied from class:AbstractWindowsTerminalRead a single input event from the input buffer and process it.- Specified by:
processConsoleInputin classAbstractWindowsTerminal- Returns:
- true if new input was generated from the event
- Throws:
IOException- if anything wrong happens
-
processKeyEvent
- Throws:
IOException
-
processFocusEvent
- Throws:
IOException
-
processMouseEvent
- Throws:
IOException
-
readConsoleInput
- Throws:
IOException
-
getCursorPosition
Description copied from interface:TerminalQuery the terminal to report the cursor position. As the response is read from the input stream, some characters may be read before the cursor position is actually read. Those characters can be given back usingorg.jline.keymap.BindingReader#runMacro(String)- Specified by:
getCursorPositionin interfaceTerminal- Overrides:
getCursorPositionin classAbstractTerminal- Parameters:
discarded- a consumer receiving discarded characters- Returns:
nullif cursor position reporting is not supported or a valid cursor position
-