mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-08 08:58:00 +00:00
Make calling term_nopaste() a cross-platform feature.
It was one of those things that went in ages ago on Windows and never got replicated in the Unix front end. And it needn't be: ldisc.c is a perfect place to put it, since it knows which of the data it's sending is based on a keystroke and which is automatically generated, and it also has access to the terminal context. So now a keypress can interrupt a runaway paste on all platforms. [originally from svn r10025]
This commit is contained in:
parent
9d5903b163
commit
4db5c2899f
4
Recipe
4
Recipe
@ -343,7 +343,7 @@ U_BE_NOSSH = be_nos_s uxser nocproxy
|
||||
putty : [G] GUITERM NONSSH WINSSH W_BE_ALL WINMISC winx11 putty.res LIBS
|
||||
puttytel : [G] GUITERM NONSSH W_BE_NOSSH WINMISC puttytel.res nogss LIBS
|
||||
plink : [C] winplink wincons NONSSH WINSSH W_BE_ALL logging WINMISC
|
||||
+ winx11 plink.res winnojmp LIBS
|
||||
+ winx11 plink.res winnojmp noterm LIBS
|
||||
pscp : [C] pscp winsftp wincons WINSSH BE_SSH SFTP wildcard WINMISC
|
||||
+ pscp.res winnojmp LIBS
|
||||
psftp : [C] psftp winsftp wincons WINSSH BE_SSH SFTP wildcard WINMISC
|
||||
@ -369,7 +369,7 @@ puttytel : [X] GTKTERM uxmisc misc ldisc settings uxsel U_BE_NOSSH
|
||||
+ nogss
|
||||
|
||||
plink : [U] uxplink uxcons NONSSH UXSSH U_BE_ALL logging UXMISC uxsignal
|
||||
+ ux_x11
|
||||
+ ux_x11 noterm
|
||||
|
||||
puttygen : [U] cmdgen sshrsag sshdssg sshprime sshdes sshbn sshmd5 version
|
||||
+ sshrand uxnoise sshsha misc sshrsa sshdss uxcons uxstore uxmisc
|
||||
|
12
ldisc.c
12
ldisc.c
@ -146,6 +146,18 @@ void ldisc_send(void *handle, char *buf, int len, int interactive)
|
||||
*/
|
||||
frontend_keypress(ldisc->frontend);
|
||||
|
||||
if (interactive && ldisc->term) {
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
11
noterm.c
Normal file
11
noterm.c
Normal file
@ -0,0 +1,11 @@
|
||||
/*
|
||||
* Stubs of functions in terminal.c, for use in programs that don't
|
||||
* have a terminal.
|
||||
*/
|
||||
|
||||
#include "putty.h"
|
||||
#include "terminal.h"
|
||||
|
||||
void term_nopaste(Terminal *term)
|
||||
{
|
||||
}
|
@ -3051,14 +3051,6 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
|
||||
return DefWindowProc(hwnd, message, wParam, lParam);
|
||||
|
||||
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(term);
|
||||
|
||||
/*
|
||||
* We need not bother about stdin backlogs
|
||||
* here, because in GUI PuTTY we can't do
|
||||
@ -4608,13 +4600,6 @@ static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam,
|
||||
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(term);
|
||||
|
||||
p = output;
|
||||
for (i = 0; i < r; i++) {
|
||||
wchar_t wch = keys_unicode[i];
|
||||
|
Loading…
Reference in New Issue
Block a user