X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fjexer%2Fio%2FECMA48Terminal.java;h=1aafa3c41619a4864d0297f1e966818e39e939da;hb=9b1afdde02c30f0d4a80ba330a4bc72384093253;hp=a4c2861ba81f988d715881e076accfa85d36a713;hpb=b5f2a6dbf2f2b925007a85f68665103ec3514f84;p=nikiroo-utils.git diff --git a/src/jexer/io/ECMA48Terminal.java b/src/jexer/io/ECMA48Terminal.java index a4c2861..1aafa3c 100644 --- a/src/jexer/io/ECMA48Terminal.java +++ b/src/jexer/io/ECMA48Terminal.java @@ -308,9 +308,9 @@ public final class ECMA48Terminal implements Runnable { } this.input = new InputStreamReader(inputStream, "UTF-8"); - // TODO: include TelnetSocket from NIB and have it implement - // SessionInfo if (input instanceof SessionInfo) { + // This is a TelnetInputStream that exposes window size and + // environment variables from the telnet layer. sessionInfo = (SessionInfo) input; } if (sessionInfo == null) { @@ -332,6 +332,7 @@ public final class ECMA48Terminal implements Runnable { // Enable mouse reporting and metaSendsEscape this.output.printf("%s%s", mouse(true), xtermMetaSendsEscape(true)); + this.output.flush(); // Hang onto the window size windowResize = new TResizeEvent(TResizeEvent.Type.SCREEN, @@ -1583,17 +1584,18 @@ public final class ECMA48Terminal implements Runnable { for (int i = 0; i < rc; i++) { int ch = readBuffer[i]; processChar(events, (char)ch); - if (events.size() > 0) { - // Add to the queue for the backend thread to - // be able to obtain. - synchronized (eventQueue) { - eventQueue.addAll(events); - } - synchronized (listener) { - listener.notifyAll(); - } - events.clear(); + } + getIdleEvents(events); + if (events.size() > 0) { + // Add to the queue for the backend thread to + // be able to obtain. + synchronized (eventQueue) { + eventQueue.addAll(events); + } + synchronized (listener) { + listener.notifyAll(); } + events.clear(); } } } else {