Class JansiWinSysTerminal
- java.lang.Object
-
- org.jline.terminal.impl.AbstractTerminal
-
- org.jline.terminal.impl.AbstractWindowsTerminal<java.lang.Long>
-
- org.jline.terminal.impl.jansi.win.JansiWinSysTerminal
-
- All Implemented Interfaces:
java.io.Closeable
,java.io.Flushable
,java.lang.AutoCloseable
,Terminal
public class JansiWinSysTerminal extends AbstractWindowsTerminal<java.lang.Long>
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.jline.terminal.Terminal
Terminal.MouseTracking, Terminal.Signal, Terminal.SignalHandler
-
-
Field Summary
Fields Modifier and Type Field Description private static long
consoleErr
private static long
consoleIn
private static long
consoleOut
private char[]
focus
private char[]
mouse
-
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, inConsole, input, lock, nativeHandlers, originalInConsoleMode, originalOutConsoleMode, outConsole, output, paused, pump, reader, slaveInputPipe, tracking, TYPE_WINDOWS, TYPE_WINDOWS_256_COLOR, TYPE_WINDOWS_CONEMU, TYPE_WINDOWS_VTP, writer
-
Fields inherited from class org.jline.terminal.impl.AbstractTerminal
bools, encoding, handlers, ints, name, onClose, palette, status, strings, type
-
Fields inherited from interface org.jline.terminal.Terminal
TYPE_DUMB, TYPE_DUMB_COLOR
-
-
Constructor Summary
Constructors Constructor Description JansiWinSysTerminal(java.io.Writer writer, java.lang.String name, java.lang.String type, java.nio.charset.Charset encoding, boolean nativeSignals, Terminal.SignalHandler signalHandler, long inConsole, int inMode, long outConsole, int outMode)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static JansiWinSysTerminal
createTerminal(java.lang.String name, java.lang.String type, boolean ansiPassThrough, java.nio.charset.Charset encoding, boolean nativeSignals, Terminal.SignalHandler signalHandler, boolean paused, TerminalProvider.Stream consoleStream)
void
disableScrolling()
private static boolean
enableVtp(long console, int outMode)
Size
getBufferSize()
Retrieve the size of the window buffer.protected int
getConsoleMode(java.lang.Long console)
Cursor
getCursorPosition(java.util.function.IntConsumer discarded)
Query the terminal to report the cursor position.(package private) static java.lang.String
getErrorMessage(int errorCode)
(package private) static java.lang.String
getLastErrorMessage()
Size
getSize()
Retrieve the size of the visible windowstatic boolean
isWindowsSystemStream(TerminalProvider.Stream stream)
private static java.io.Writer
newConsoleWriter(long console)
protected boolean
processConsoleInput()
Read a single input event from the input buffer and process it.private void
processFocusEvent(boolean hasFocus)
private void
processMouseEvent(org.fusesource.jansi.internal.Kernel32.MOUSE_EVENT_RECORD mouseEvent)
protected void
setConsoleMode(java.lang.Long console, 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, writer
-
Methods 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
-
-
-
-
Constructor Detail
-
JansiWinSysTerminal
JansiWinSysTerminal(java.io.Writer writer, java.lang.String name, java.lang.String type, java.nio.charset.Charset encoding, boolean nativeSignals, Terminal.SignalHandler signalHandler, long inConsole, int inMode, long outConsole, int outMode) throws java.io.IOException
- Throws:
java.io.IOException
-
-
Method Detail
-
createTerminal
public static JansiWinSysTerminal createTerminal(java.lang.String name, java.lang.String type, boolean ansiPassThrough, java.nio.charset.Charset encoding, boolean nativeSignals, Terminal.SignalHandler signalHandler, boolean paused, TerminalProvider.Stream consoleStream) throws java.io.IOException
- Throws:
java.io.IOException
-
enableVtp
private static boolean enableVtp(long console, int outMode)
-
newConsoleWriter
private static java.io.Writer newConsoleWriter(long console)
-
isWindowsSystemStream
public static boolean isWindowsSystemStream(TerminalProvider.Stream stream)
-
getConsoleMode
protected int getConsoleMode(java.lang.Long console)
- Specified by:
getConsoleMode
in classAbstractWindowsTerminal<java.lang.Long>
-
setConsoleMode
protected void setConsoleMode(java.lang.Long console, int mode)
- Specified by:
setConsoleMode
in classAbstractWindowsTerminal<java.lang.Long>
-
getSize
public Size getSize()
Description copied from interface:Terminal
Retrieve the size of the visible window- Returns:
- the visible terminal size
- See Also:
Terminal.getBufferSize()
-
getBufferSize
public Size getBufferSize()
Description copied from interface:Terminal
Retrieve 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:
Terminal.getSize()
-
processConsoleInput
protected boolean processConsoleInput() throws java.io.IOException
Description copied from class:AbstractWindowsTerminal
Read a single input event from the input buffer and process it.- Specified by:
processConsoleInput
in classAbstractWindowsTerminal<java.lang.Long>
- Returns:
- true if new input was generated from the event
- Throws:
java.io.IOException
- if anything wrong happens
-
processFocusEvent
private void processFocusEvent(boolean hasFocus) throws java.io.IOException
- Throws:
java.io.IOException
-
processMouseEvent
private void processMouseEvent(org.fusesource.jansi.internal.Kernel32.MOUSE_EVENT_RECORD mouseEvent) throws java.io.IOException
- Throws:
java.io.IOException
-
getCursorPosition
public Cursor getCursorPosition(java.util.function.IntConsumer discarded)
Description copied from interface:Terminal
Query 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:
getCursorPosition
in interfaceTerminal
- Overrides:
getCursorPosition
in classAbstractTerminal
- Parameters:
discarded
- a consumer receiving discarded characters- Returns:
null
if cursor position reporting is not supported or a valid cursor position
-
disableScrolling
public void disableScrolling()
-
getLastErrorMessage
static java.lang.String getLastErrorMessage()
-
getErrorMessage
static java.lang.String getErrorMessage(int errorCode)
-
-