#18 repaint after screen resize
authorKevin Lamonte <kevin.lamonte@gmail.com>
Thu, 17 Aug 2017 13:05:23 +0000 (09:05 -0400)
committerKevin Lamonte <kevin.lamonte@gmail.com>
Thu, 17 Aug 2017 13:05:23 +0000 (09:05 -0400)
src/jexer/TApplication.java
src/jexer/backend/ECMA48Terminal.java
src/jexer/backend/TTYSessionInfo.java

index 105f1ce97cfa5a047e9502a1c8bf9877d6200fa8..cedb631f77fa40188112ac5caa04e2dd67756733 100644 (file)
@@ -1030,6 +1030,8 @@ public class TApplication implements Runnable {
                     desktop.setDimensions(0, 0, resize.getWidth(),
                         resize.getHeight() - 1);
                 }
+                // We are dirty, redraw the screen.
+                doRepaint();
                 return;
             }
 
index ea99a0b79eeaf7adb24fe8c2e7a7f01b4c99f45c..56c2c7c348943479a46c85d449d11932a4ec66a3 100644 (file)
@@ -1107,9 +1107,18 @@ public final class ECMA48Terminal extends LogicalScreen
             sessionInfo.queryWindowSize();
             int newWidth = sessionInfo.getWindowWidth();
             int newHeight = sessionInfo.getWindowHeight();
+
             if ((newWidth != windowResize.getWidth())
                 || (newHeight != windowResize.getHeight())
             ) {
+
+                if (debugToStderr) {
+                    System.err.println("Screen size changed, old size " +
+                        windowResize);
+                    System.err.println("                     new size " +
+                        newWidth + " x " + newHeight);
+                }
+
                 TResizeEvent event = new TResizeEvent(TResizeEvent.Type.SCREEN,
                     newWidth, newHeight);
                 windowResize = new TResizeEvent(TResizeEvent.Type.SCREEN,
@@ -1870,14 +1879,27 @@ public final class ECMA48Terminal extends LogicalScreen
                 // We assume that if inputStream has bytes available, then
                 // input won't block on read().
                 int n = inputStream.available();
+
+                /*
+                System.err.printf("inputStream.available(): %d\n", n);
+                System.err.flush();
+                */
+
                 if (n > 0) {
                     if (readBuffer.length < n) {
                         // The buffer wasn't big enough, make it huger
                         readBuffer = new char[readBuffer.length * 2];
                     }
 
+                    // System.err.printf("BEFORE read()\n"); System.err.flush();
+
                     int rc = input.read(readBuffer, 0, readBuffer.length);
-                    // System.err.printf("read() %d", rc); System.err.flush();
+
+                    /*
+                    System.err.printf("AFTER read() %d\n", rc);
+                    System.err.flush();
+                    */
+
                     if (rc == -1) {
                         // This is EOF
                         done = true;
@@ -1907,16 +1929,16 @@ public final class ECMA48Terminal extends LogicalScreen
                         synchronized (eventQueue) {
                             eventQueue.addAll(events);
                         }
-                        events.clear();
                         if (listener != null) {
                             synchronized (listener) {
                                 listener.notifyAll();
                             }
                         }
+                        events.clear();
                     }
 
-                    // Wait 10 millis for more data
-                    Thread.sleep(10);
+                    // Wait 20 millis for more data
+                    Thread.sleep(20);
                 }
                 // System.err.println("end while loop"); System.err.flush();
             } catch (InterruptedException e) {
index 22d5314eb9ed819e36c0eca16d43a60fec561993..67b2e5c4b9f357e125cb4077ec1e38a0d76e49fc 100644 (file)
@@ -183,8 +183,9 @@ public final class TTYSessionInfo implements SessionInfo {
             lastQueryWindowTime = System.currentTimeMillis();
         } else {
             long nowTime = System.currentTimeMillis();
-            if (nowTime - lastQueryWindowTime < 3000) {
-                // Don't re-spawn stty, it's been too soon.
+            if (nowTime - lastQueryWindowTime < 1000) {
+                // Don't re-spawn stty if it hasn't been a full second since
+                // the last time.
                 return;
             }
         }