[Swift-commit] r2787 - trunk/src/org/griphyn/vdl/karajan/monitor/monitors/ansi/tui
noreply at svn.ci.uchicago.edu
noreply at svn.ci.uchicago.edu
Mon Mar 30 19:31:33 CDT 2009
Author: hategan
Date: 2009-03-30 19:31:33 -0500 (Mon, 30 Mar 2009)
New Revision: 2787
Modified:
trunk/src/org/griphyn/vdl/karajan/monitor/monitors/ansi/tui/ANSIContext.java
Log:
double ESC for escape; ESC+n for Fn emulation
Modified: trunk/src/org/griphyn/vdl/karajan/monitor/monitors/ansi/tui/ANSIContext.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/monitor/monitors/ansi/tui/ANSIContext.java 2009-03-31 00:22:13 UTC (rev 2786)
+++ trunk/src/org/griphyn/vdl/karajan/monitor/monitors/ansi/tui/ANSIContext.java 2009-03-31 00:31:33 UTC (rev 2787)
@@ -245,7 +245,8 @@
if (count == 0) {
count = 10;
int[] size = querySize();
- if (size != null && (size[0] != buf.getWidth() || size[1] != buf.getHeight())) {
+ if (size != null
+ && (size[0] != buf.getWidth() || size[1] != buf.getHeight())) {
buf.resize(size[0], size[1]);
screen.setSize(size[0], size[1]);
screen.invalidate();
@@ -266,48 +267,46 @@
Key key;
int c = read();
if (c == 27) {
- try {
- Thread.sleep(25);
+ c = read();
+ if (c == 27) {
+ key = new Key(0, 27);
}
- catch (InterruptedException e) {
- return;
+ else if (c >= '1' && c <= '5') {
+ key = new Key(0, Key.F1 + c - '1');
}
- if (is.available() == 0) {
- key = new Key(0, c);
+ else if (c >= '6' && c <= '9') {
+ key = new Key(0, Key.F6 + c - '6');
}
- else {
- c = read();
- if (c == '[') {
- int c0 = read();
- if (c0 <= 54) {
- int c1 = read();
- if (c1 == '~') {
- key = new Key(0, Key.KEYPAD2 + c0);
+ else if (c == '[') {
+ int c0 = read();
+ if (c0 <= 54) {
+ int c1 = read();
+ if (c1 == '~') {
+ key = new Key(0, Key.KEYPAD2 + c0);
+ }
+ else {
+ int c2 = read();
+ if (c2 == '~') {
+ key = new Key(c0, c1, 0);
}
else {
- int c2 = read();
- if (c2 == '~') {
- key = new Key(c0, c1, 0);
- }
- else {
- key = new Key(c0, c1, is.read());
- read();
- }
+ key = new Key(c0, c1, is.read());
+ read();
}
}
- else {
- key = new Key(0, Key.KEYPAD + c0);
- }
}
- else if (c == 'O') {
- // OS X F1 - F4
- int c0 = read();
- key = new Key(0, Key.F1 + (c0 - 'P'));
- }
else {
- key = new Key(Key.MOD_ALT, c);
+ key = new Key(0, Key.KEYPAD + c0);
}
}
+ else if (c == 'O') {
+ // OS X F1 - F4
+ int c0 = read();
+ key = new Key(0, Key.F1 + (c0 - 'P'));
+ }
+ else {
+ key = new Key(Key.MOD_ALT, c);
+ }
}
else if (c < 32 && c != 0x0a && c != 0x0d) {
key = new Key(Key.MOD_CTRL, c + 96);
@@ -335,13 +334,7 @@
e.printStackTrace();
}
}
- if (!done) {
- moveTo(1, 1);
- bgColor(ANSI.RED);
- fgColor(ANSI.WHITE);
- text(key.toString());
- sync();
- }
+ //screen.status(key.toString());
}
}
catch (Exception e) {
@@ -377,7 +370,7 @@
}
}
int c = is.read();
- System.err.print("\n" + c + " - " + (char) c);
+ //logger.warn("CONSOLE IN: " + c + " - " + (char) c);
return c;
}
@@ -506,10 +499,10 @@
public void echo(boolean b) throws IOException {
if (b) {
- // terminal.enableEcho();
+ terminal.enableEcho();
}
else {
- // terminal.disableEcho();
+ terminal.disableEcho();
}
}
@@ -518,16 +511,26 @@
}
public synchronized void lock() {
- /*
- * while (lock > 0) { try { wait(); } catch (InterruptedException e) {
- * e.printStackTrace(); } } lock++;
- */
+ if (!doubleBuffered) {
+ while (lock > 0) {
+ try {
+ wait();
+ }
+ catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ lock++;
+ }
}
public synchronized void unlock() {
- /*
- * lock--; if (lock == 0) { notifyAll(); }
- */
+ if (!doubleBuffered) {
+ lock--;
+ if (lock == 0) {
+ notifyAll();
+ }
+ }
}
public void exit() {
More information about the Swift-commit
mailing list