private Tuple2<Attributes, Map<Signal, SignalHandler>> prepareTerminal() { final Terminal terminal = client.getTerminal(); final Attributes prevAttributes = terminal.getAttributes(); // adopted from org.jline.builtins.Nano // see also https://en.wikibooks.org/wiki/Serial_Programming/termios#Basic_Configuration_of_a_Serial_Interface // no line processing // canonical mode off, echo off, echo newline off, extended input processing off Attributes newAttr = new Attributes(prevAttributes); newAttr.setLocalFlags(EnumSet.of(LocalFlag.ICANON, LocalFlag.ECHO, LocalFlag.IEXTEN), false); // turn off input processing newAttr.setInputFlags(EnumSet.of(Attributes.InputFlag.IXON, Attributes.InputFlag.ICRNL, Attributes.InputFlag.INLCR), false); // one input byte is enough to return from read, inter-character timer off newAttr.setControlChar(Attributes.ControlChar.VMIN, 1); newAttr.setControlChar(Attributes.ControlChar.VTIME, 0); newAttr.setControlChar(Attributes.ControlChar.VINTR, 0); terminal.setAttributes(newAttr); final Map<Signal, SignalHandler> prevSignals = new HashMap<>(); prevSignals.put(Signal.WINCH, terminal.handle(Signal.WINCH, this::handleSignal)); prevSignals.put(Signal.INT, terminal.handle(Signal.INT, this::handleSignal)); prevSignals.put(Signal.QUIT, terminal.handle(Signal.QUIT, this::handleSignal)); return Tuple2.of(prevAttributes, prevSignals); }
public Attributes getAttributes() { Attributes attr = new Attributes(); attr.copy(attributes); return attr; }
@Override public void setAttr(Attributes attr) throws IOException { current = new Attributes(attr); doSetAttr(attr); }
public Attributes getAttributes() { Attributes attr = new Attributes(); attr.copy(attributes); return attr; }
public Attributes getAttributes() { int mode = getConsoleMode(); if ((mode & ENABLE_ECHO_INPUT) != 0) { attributes.setLocalFlag(Attributes.LocalFlag.ECHO, true); } if ((mode & ENABLE_LINE_INPUT) != 0) { attributes.setLocalFlag(Attributes.LocalFlag.ICANON, true); } return new Attributes(attributes); }
public Attributes enterRawMode() { Attributes prvAttr = getAttributes(); Attributes newAttr = new Attributes(prvAttr); newAttr.setLocalFlags(EnumSet.of(LocalFlag.ICANON, LocalFlag.ECHO, LocalFlag.IEXTEN), false); newAttr.setInputFlags(EnumSet.of(InputFlag.IXON, InputFlag.ICRNL, InputFlag.INLCR), false); newAttr.setControlChar(ControlChar.VMIN, 0); newAttr.setControlChar(ControlChar.VTIME, 1); setAttributes(newAttr); return prvAttr; }
static Attributes doGetAttr(String cfg) throws IOException { Attributes attributes = new Attributes(); for (InputFlag flag : InputFlag.values()) { Boolean value = doGetFlag(cfg, flag);
this.reader = NonBlocking.nonBlocking(getName(), input, encoding()); this.writer = new PrintWriter(new OutputStreamWriter(output, encoding())); this.attributes = new Attributes(); this.attributes.setControlChar(ControlChar.VERASE, (char) 127); this.attributes.setControlChar(ControlChar.VWERASE, (char) 23);
Attributes newAttributes = new Attributes(prevStatus.attributes);
public Attributes toAttributes() { Attributes attr = new Attributes();
public Attributes toAttributes() { Attributes attr = new Attributes();
protected Attributes toAttributes(CLibrary.Termios tio) { Attributes attr = new Attributes();
public Attributes toAttributes() { Attributes attr = new Attributes();
public Attributes toAttributes() { Attributes attr = new Attributes();
public Attributes toAttributes() { Attributes attr = new Attributes();
public Attributes toAttributes() { Attributes attr = new Attributes();
protected Attributes toAttributes(CLibrary.Termios tio) { Attributes attr = new Attributes();
protected Attributes toAttributes(CLibrary.Termios tio) { Attributes attr = new Attributes();
protected Attributes toAttributes(CLibrary.Termios tio) { Attributes attr = new Attributes();
public Attributes toAttributes() { Attributes attr = new Attributes();