Ongoing pastes were being abandoned on any key-down event. Quite
authorsimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Fri, 21 Sep 2001 17:54:29 +0000 (17:54 +0000)
committersimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Fri, 21 Sep 2001 17:54:29 +0000 (17:54 +0000)
apart from the debatable semantic sanity of abandoning mid-paste,
this was breaking Shift-paste (theoretically valid in any case,
actually necessary with xterm mouse reporting enabled) because when
you hold down Shift the window receives a steady stream of KEYDOWN
messages as the key auto-repeats. One of those is likely to show up
in mid-paste and scupper you. For the moment, this has been changed
so that only a key press that actually _generates session data_
aborts a paste. In future I plan to review just why we're doing this
anyway (it may be that paste-little-by-little was a response to
rubbish socket buffering, in which case we can dispense with it
completely now).

git-svn-id: svn://svn.tartarus.org/sgt/putty@1279 cda61777-01e9-0310-a592-d414129be87e

window.c

index 7ffa4d9..b887aca 100644 (file)
--- a/window.c
+++ b/window.c
@@ -2143,6 +2143,14 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
 
                if (len != 0) {
                    /*
+                    * Interrupt an ongoing paste. I'm not sure
+                    * this is sensible, but for the moment it's
+                    * preferable to having to faff about buffering
+                    * things.
+                    */
+                   term_nopaste();
+
+                   /*
                     * We need not bother about stdin backlogs
                     * here, because in GUI PuTTY we can't do
                     * anything about it anyway; there's no means
@@ -2823,10 +2831,6 @@ static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam,
        seen_key_event = 1;
     }
 
-    /* Make sure we're not pasting */
-    if (key_down)
-       term_nopaste();
-
     if (compose_state > 1 && left_alt)
        compose_state = 0;
 
@@ -3356,6 +3360,14 @@ static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam,
 #endif
        if (r > 0) {
            WCHAR keybuf;
+
+           /*
+            * Interrupt an ongoing paste. I'm not sure this is
+            * sensible, but for the moment it's preferable to
+            * having to faff about buffering things.
+            */
+           term_nopaste();
+
            p = output;
            for (i = 0; i < r; i++) {
                unsigned char ch = (unsigned char) keys[i];