X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=ldisc.c;h=320a93607c3cb6204732bf0e4889e4a9db9e32ba;hb=2eb952ca31aa13d1f6f429305fbb6f43a9a28c56;hp=efbb871488d7f0b64972369295349d7fff9c46cb;hpb=a1f3b7a358adaa7c2a98359cd0373aa823eeb14b;p=PuTTY.git diff --git a/ldisc.c b/ldisc.c index efbb8714..320a9360 100644 --- a/ldisc.c +++ b/ldisc.c @@ -7,6 +7,7 @@ #include #include +#include #include "putty.h" #include "terminal.h" @@ -21,7 +22,7 @@ (ldisc->back->ldisc(ldisc->backhandle, LD_EDIT) || \ term_ldisc(ldisc->term, LD_EDIT)))) -static void c_write(Ldisc ldisc, char *buf, int len) +static void c_write(Ldisc ldisc, const char *buf, int len) { from_backend(ldisc->frontend, 0, buf, len); } @@ -127,18 +128,20 @@ void ldisc_free(void *handle) sfree(ldisc); } -void ldisc_send(void *handle, char *buf, int len, int interactive) +void ldisc_echoedit_update(void *handle) +{ + Ldisc ldisc = (Ldisc) handle; + frontend_echoedit_update(ldisc->frontend, ECHOING, EDITING); +} + +void ldisc_send(void *handle, const char *buf, int len, int interactive) { Ldisc ldisc = (Ldisc) handle; int keyflag = 0; - /* - * Called with len=0 when the options change. We must inform - * the front end in case it needs to know. - */ - if (len == 0) { - ldisc_update(ldisc->frontend, ECHOING, EDITING); - return; - } + + assert(ldisc->term); + assert(len); + /* * Notify the front end that something was pressed, in case * it's depending on finding out (e.g. keypress termination for @@ -146,6 +149,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. */