X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fjexer%2FTTerminalWidget.java;h=6c8b9894a016c70797e123c96a35911bb864914e;hb=04050859e05bb4113349bcfaab4840a8c88d2aa5;hp=a2696092ce82ee7ed0550a0019b6b8fc0c9c785d;hpb=1104f8d721d6fe7d6ec577389ddcee6ed1470385;p=fanfix.git diff --git a/src/jexer/TTerminalWidget.java b/src/jexer/TTerminalWidget.java index a269609..6c8b989 100644 --- a/src/jexer/TTerminalWidget.java +++ b/src/jexer/TTerminalWidget.java @@ -541,9 +541,7 @@ public class TTerminalWidget extends TScrollableWidget int width = getDisplayWidth(); boolean syncEmulator = false; - if ((System.currentTimeMillis() - lastUpdateTime >= 20) - && (dirty == true) - ) { + if (System.currentTimeMillis() - lastUpdateTime >= 50) { // Too much time has passed, draw it all. syncEmulator = true; } else if (emulator.isReading() && (dirty == false)) { @@ -1125,7 +1123,17 @@ public class TTerminalWidget extends TScrollableWidget * Called by emulator when fresh data has come in. */ public void displayChanged() { - dirty = true; + if (emulator != null) { + // Force sync here: EMCA48.run() thread might be setting + // dirty=true while TTerminalWdiget.draw() is setting + // dirty=false. If these writes start interleaving, the display + // stops getting updated. + synchronized (emulator) { + dirty = true; + } + } else { + dirty = true; + } getApplication().postEvent(new TMenuEvent(TMenu.MID_REPAINT)); }