]> asedeno.scripts.mit.edu Git - PuTTY.git/blobdiff - ldisc.c
bignum_set_bit: Don't abort if asked to clear an inaccessible bit
[PuTTY.git] / ldisc.c
diff --git a/ldisc.c b/ldisc.c
index efbb871488d7f0b64972369295349d7fff9c46cb..311854060e03038b84f9f9e90ae4718e95a1a7b4 100644 (file)
--- a/ldisc.c
+++ b/ldisc.c
@@ -7,6 +7,7 @@
 
 #include <stdio.h>
 #include <ctype.h>
+#include <assert.h>
 
 #include "putty.h"
 #include "terminal.h"
@@ -139,6 +140,17 @@ void ldisc_send(void *handle, char *buf, int len, int interactive)
        ldisc_update(ldisc->frontend, ECHOING, EDITING);
        return;
     }
+
+    /*
+     * If that wasn't true, then we expect ldisc->term to be non-NULL
+     * hereafter. (The only front ends which have an ldisc but no term
+     * are those which do networking but no terminal emulation, in
+     * which case they need the above if statement to handle
+     * ldisc_updates passed from the back ends, but should never send
+     * any actual input through this function.)
+     */
+    assert(ldisc->term);
+
     /*
      * Notify the front end that something was pressed, in case
      * it's depending on finding out (e.g. keypress termination for
@@ -146,6 +158,18 @@ void ldisc_send(void *handle, char *buf, int len, int interactive)
      */
     frontend_keypress(ldisc->frontend);
 
+    if (interactive) {
+        /*
+         * Interrupt a paste from the clipboard, if one was in
+         * progress when the user pressed a key. This is easier than
+         * buffering the current piece of data and saving it until the
+         * terminal has finished pasting, and has the potential side
+         * benefit of permitting a user to cancel an accidental huge
+         * paste.
+         */
+        term_nopaste(ldisc->term);
+    }
+
     /*
      * Less than zero means null terminated special string.
      */