[Swift-commit] r2813 - trunk/src/org/griphyn/vdl/karajan/monitor/monitors/ansi/tui
noreply at svn.ci.uchicago.edu
noreply at svn.ci.uchicago.edu
Sat Apr 4 11:35:26 CDT 2009
Author: hategan
Date: 2009-04-04 11:35:25 -0500 (Sat, 04 Apr 2009)
New Revision: 2813
Modified:
trunk/src/org/griphyn/vdl/karajan/monitor/monitors/ansi/tui/ANSIContext.java
trunk/src/org/griphyn/vdl/karajan/monitor/monitors/ansi/tui/Key.java
Log:
better cleanup and proper handling of tab key
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-04-04 16:06:23 UTC (rev 2812)
+++ trunk/src/org/griphyn/vdl/karajan/monitor/monitors/ansi/tui/ANSIContext.java 2009-04-04 16:35:25 UTC (rev 2813)
@@ -128,6 +128,11 @@
terminal.initializeTerminal();
os.write(ANSI.cursorVisible(false));
os.flush();
+ Runtime.getRuntime().addShutdownHook(new Thread() {
+ public void run() {
+ exit();
+ }
+ });
}
catch (Exception e) {
e.printStackTrace();
@@ -309,7 +314,12 @@
}
}
else if (c < 32 && c != 0x0a && c != 0x0d) {
- key = new Key(Key.MOD_CTRL, c + 96);
+ if (c == 9) {
+ key = new Key(Key.TAB);
+ }
+ else {
+ key = new Key(Key.MOD_CTRL, c + 96);
+ }
}
else if (c > 128) {
// XTerm
@@ -334,7 +344,7 @@
e.printStackTrace();
}
}
- //screen.status(key.toString());
+ screen.status(key.toString());
}
}
catch (Exception e) {
@@ -360,6 +370,9 @@
screen.redraw();
}
else {
+ if (done) {
+ return 0;
+ }
try {
checkSize();
Thread.sleep(10);
@@ -534,6 +547,7 @@
}
public void exit() {
+ done = true;
try {
os.write(ANSI.cursorVisible(true));
os.flush();
@@ -541,7 +555,6 @@
catch (Exception e) {
e.printStackTrace();
}
- done = true;
screen = null;
if (terminal instanceof UnixTerminal) {
try {
Modified: trunk/src/org/griphyn/vdl/karajan/monitor/monitors/ansi/tui/Key.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/monitor/monitors/ansi/tui/Key.java 2009-04-04 16:06:23 UTC (rev 2812)
+++ trunk/src/org/griphyn/vdl/karajan/monitor/monitors/ansi/tui/Key.java 2009-04-04 16:35:25 UTC (rev 2813)
@@ -45,6 +45,7 @@
public static final int CR = 0x0d;
public static final int BACKSPACE = 0x7f;
public static final int ESC = 0x1b;
+ public static final int TAB = 0x09;
private static Map names;
@@ -80,6 +81,7 @@
putName(END, "END");
putName(INS, "INS");
putName(DEL, "DEL");
+ putName(TAB, "TAB");
}
private final int type;
More information about the Swift-commit
mailing list