aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul "LeoNerd" Evans <leonerd@leonerd.org.uk>2012-10-27 17:33:26 +0100
committerPaul "LeoNerd" Evans <leonerd@leonerd.org.uk>2012-10-27 17:33:26 +0100
commit3d54a8402531d8642df9af9341d8ec699a3b1fc0 (patch)
treed2de839661ad4396f2156f5d868b43bd5c0dbef2 /src
parent29ec938de5106be2bbf89a4a6073ac22f287f7b4 (diff)
downloadconnectbot-3d54a8402531d8642df9af9341d8ec699a3b1fc0.tar.gz
connectbot-3d54a8402531d8642df9af9341d8ec699a3b1fc0.tar.bz2
connectbot-3d54a8402531d8642df9af9341d8ec699a3b1fc0.zip
Fix Enter==Ctrl-M again
Without this, commit 8ac74bb made the Enter key send Ctrl-J which broke some programs, though most didn't notice because termios() canonicalised either to '\n'. Also renamed the 'key' variable to 'uchar' since it holds a Unicode character number and not a keycode.
Diffstat (limited to 'src')
-rw-r--r--src/org/connectbot/service/TerminalKeyListener.java22
1 files changed, 10 insertions, 12 deletions
diff --git a/src/org/connectbot/service/TerminalKeyListener.java b/src/org/connectbot/service/TerminalKeyListener.java
index 952f3cd..b825e6b 100644
--- a/src/org/connectbot/service/TerminalKeyListener.java
+++ b/src/org/connectbot/service/TerminalKeyListener.java
@@ -186,28 +186,26 @@ public class TerminalKeyListener implements OnKeyListener, OnSharedPreferenceCha
curMetaState |= KeyEvent.META_ALT_ON;
}
- int key = event.getUnicodeChar(curMetaState);
+ int uchar = event.getUnicodeChar(curMetaState);
// no hard keyboard? ALT-k should pass through to below
if ((orgMetaState & KeyEvent.META_ALT_ON) != 0 &&
(!hardKeyboard || hardKeyboardHidden)) {
- key = 0;
+ uchar = 0;
}
- if ((key & KeyCharacterMap.COMBINING_ACCENT) != 0) {
- mDeadKey = key & KeyCharacterMap.COMBINING_ACCENT_MASK;
+ if ((uchar & KeyCharacterMap.COMBINING_ACCENT) != 0) {
+ mDeadKey = uchar & KeyCharacterMap.COMBINING_ACCENT_MASK;
return true;
}
if (mDeadKey != 0) {
- key = KeyCharacterMap.getDeadChar(mDeadKey, keyCode);
+ uchar = KeyCharacterMap.getDeadChar(mDeadKey, keyCode);
mDeadKey = 0;
}
- final boolean printing = (key != 0);
-
// otherwise pass through to existing session
// print normal keys
- if (printing) {
+ if (uchar >= 0x20) {
metaState &= ~(META_SLASH | META_TAB);
// Remove shift and alt modifiers
@@ -227,7 +225,7 @@ public class TerminalKeyListener implements OnKeyListener, OnSharedPreferenceCha
&& sendFunctionKey(keyCode))
return true;
- key = keyAsControl(key);
+ uchar = keyAsControl(uchar);
}
// handle pressing f-keys
@@ -236,11 +234,11 @@ public class TerminalKeyListener implements OnKeyListener, OnSharedPreferenceCha
&& sendFunctionKey(keyCode))
return true;
- if (key < 0x80)
- bridge.transport.write(key);
+ if (uchar < 0x80)
+ bridge.transport.write(uchar);
else
// TODO write encoding routine that doesn't allocate each time
- bridge.transport.write(new String(Character.toChars(key))
+ bridge.transport.write(new String(Character.toChars(uchar))
.getBytes(encoding));
return true;