diff src/com/five_ten_sg/connectbot/transport/TN5250.java @ 84:8f23b05a51f7

convert ctrl keys to virtual keys; use proper android home directory
author Carl Byington <carl@five-ten-sg.com>
date Mon, 16 Jun 2014 11:25:37 -0700
parents 7ae9b0c382ec
children 1bc2229562f8
line wrap: on
line diff
--- a/src/com/five_ten_sg/connectbot/transport/TN5250.java	Mon Jun 16 10:43:30 2014 -0700
+++ b/src/com/five_ten_sg/connectbot/transport/TN5250.java	Mon Jun 16 11:25:37 2014 -0700
@@ -70,6 +70,7 @@
 
 
     class vt320x5250 extends vt320 {
+        private HashMap<Integer, Integer> controls;
         private HashMap<Integer, String> mnemonics;
 
         public vt320x5250() {
@@ -78,6 +79,12 @@
 
         public vt320x5250(int width, int height) {
             super(width, height);
+            controls = new HashMap<Integer, Integer>();
+            controls.put(0x08, KEY_BACK_SPACE);
+            controls.put(0x09, KEY_TAB);
+            controls.put(0x0d, KEY_ENTER);
+            controls.put(0x1b, KEY_ESCAPE);
+
             mnemonics = new HashMap<Integer, String>();
             mnemonics.put(KEY_PAUSE       , "[attn]");
             mnemonics.put(KEY_F1          , "[pf1]");
@@ -144,8 +151,13 @@
         }
         @Override
         public void write(int b) {
-            if (bridge.monitor != null) bridge.monitor.hostData(b);
-            screen52.sendKeys(new String(new byte[] {(byte)b}));
+            if (controls.containsKey(b)) {
+                keyPressed(controls.get(b), ' ', 0);
+            }
+            else {
+                if (bridge.monitor != null) bridge.monitor.hostData(b);
+                screen52.sendKeys(new String(new byte[] {(byte)b}));
+            }
         }
         @Override
         public void keyPressed(int keyCode, char keyChar, int modifiers) {