diff src/com/five_ten_sg/connectbot/service/TerminalMonitor.java @ 16:48a8daea9221

delay sending cursor move notifications until the host is quiet
author Carl Byington <carl@five-ten-sg.com>
date Thu, 29 May 2014 20:15:58 -0700
parents 1588e359a972
children 02717d15de9b
line wrap: on
line diff
--- a/src/com/five_ten_sg/connectbot/service/TerminalMonitor.java	Thu May 29 12:40:27 2014 -0700
+++ b/src/com/five_ten_sg/connectbot/service/TerminalMonitor.java	Thu May 29 20:15:58 2014 -0700
@@ -46,7 +46,10 @@
     private int                 end_line     = 500;     // ""
     private int                 start_column = 0;       // ""
     private int                 end_column   = 500;     // ""
-    private boolean             modified     = false;   // ""
+    private boolean             modified     = false;   // used to delay screen change notifications
+    private boolean             moved        = false;   // used to delay cursor moved notifications
+    private int                 to_line      = 0;       // ""
+    private int                 to_column    = 0;       // ""
     private HashMap<Integer,Integer>  keymap = null;
     private IBinder             bound        = null;
     private Socket              monitor_socket = null;
@@ -323,6 +326,12 @@
     }
 
     public synchronized void cursorMove(int l, int c) {
+        moved = true;
+        to_line = l
+        to_column = c;
+    }
+
+    public void cursorMoved() {
         char[] arg = new char[4];
         arg[2] = (char)(l & 0x0000ffff);
         arg[3] = (char)(c & 0x0000ffff);
@@ -334,6 +343,10 @@
             modified = false;
             sendScreen(MONITOR_CMD_SCREENCHANGE);
         }
+        if (moved) {
+            moved = false;
+            cursorMoved();
+        }
     }
 
     public synchronized void screenChanged(int llow, int lhigh, int clow, int chigh) {