git://git.nikiroo.be
/
nikiroo-utils.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix bounds check
[nikiroo-utils.git]
/
src
/
jexer
/
backend
/
ECMA48Terminal.java
diff --git
a/src/jexer/backend/ECMA48Terminal.java
b/src/jexer/backend/ECMA48Terminal.java
index ea99a0b79eeaf7adb24fe8c2e7a7f01b4c99f45c..56c2c7c348943479a46c85d449d11932a4ec66a3 100644
(file)
--- a/
src/jexer/backend/ECMA48Terminal.java
+++ b/
src/jexer/backend/ECMA48Terminal.java
@@
-1107,9
+1107,18
@@
public final class ECMA48Terminal extends LogicalScreen
sessionInfo.queryWindowSize();
int newWidth = sessionInfo.getWindowWidth();
int newHeight = sessionInfo.getWindowHeight();
sessionInfo.queryWindowSize();
int newWidth = sessionInfo.getWindowWidth();
int newHeight = sessionInfo.getWindowHeight();
+
if ((newWidth != windowResize.getWidth())
|| (newHeight != windowResize.getHeight())
) {
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,
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();
// 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];
}
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);
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;
if (rc == -1) {
// This is EOF
done = true;
@@
-1907,16
+1929,16
@@
public final class ECMA48Terminal extends LogicalScreen
synchronized (eventQueue) {
eventQueue.addAll(events);
}
synchronized (eventQueue) {
eventQueue.addAll(events);
}
- events.clear();
if (listener != null) {
synchronized (listener) {
listener.notifyAll();
}
}
if (listener != null) {
synchronized (listener) {
listener.notifyAll();
}
}
+ events.clear();
}
}
- // Wait
1
0 millis for more data
- Thread.sleep(
1
0);
+ // Wait
2
0 millis for more data
+ Thread.sleep(
2
0);
}
// System.err.println("end while loop"); System.err.flush();
} catch (InterruptedException e) {
}
// System.err.println("end while loop"); System.err.flush();
} catch (InterruptedException e) {