mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-09 17:38:00 +00:00
Fix pasting of newlines in local line editing mode. Possibly not a
very _good_ fix; something might want doing after the release. [originally from svn r1277]
This commit is contained in:
parent
6364ff3e71
commit
39c3f9b8bc
4
ldisc.c
4
ldisc.c
@ -61,7 +61,7 @@ static void bsb(int n)
|
||||
#define CTRL(x) (x^'@')
|
||||
#define KCTRL(x) ((x^'@') | 0x100)
|
||||
|
||||
void ldisc_send(char *buf, int len)
|
||||
void ldisc_send(char *buf, int len, int interactive)
|
||||
{
|
||||
int keyflag = 0;
|
||||
/*
|
||||
@ -86,6 +86,8 @@ void ldisc_send(char *buf, int len)
|
||||
while (len--) {
|
||||
int c;
|
||||
c = *buf++ + keyflag;
|
||||
if (!interactive && c == '\r')
|
||||
c += KCTRL('@');
|
||||
switch (term_quotenext ? ' ' : c) {
|
||||
/*
|
||||
* ^h/^?: delete one char and output one BSB
|
||||
|
2
psftp.c
2
psftp.c
@ -1395,7 +1395,7 @@ void logevent(char *string)
|
||||
{
|
||||
}
|
||||
|
||||
void ldisc_send(char *buf, int len)
|
||||
void ldisc_send(char *buf, int len, int interactive)
|
||||
{
|
||||
/*
|
||||
* This is only here because of the calls to ldisc_send(NULL,
|
||||
|
6
putty.h
6
putty.h
@ -496,7 +496,7 @@ extern Backend ssh_backend;
|
||||
* Exports from ldisc.c.
|
||||
*/
|
||||
|
||||
extern void ldisc_send(char *buf, int len);
|
||||
extern void ldisc_send(char *buf, int len, int interactive);
|
||||
|
||||
/*
|
||||
* Exports from sshrand.c.
|
||||
@ -531,8 +531,8 @@ void EnableSizeTip(int bEnable);
|
||||
#define CP_UTF8 65001
|
||||
#endif
|
||||
void init_ucs_tables(void);
|
||||
void lpage_send(int codepage, char *buf, int len);
|
||||
void luni_send(wchar_t * widebuf, int len);
|
||||
void lpage_send(int codepage, char *buf, int len, int interactive);
|
||||
void luni_send(wchar_t * widebuf, int len, int interactive);
|
||||
wchar_t xlat_uskbd2cyrllic(int ch);
|
||||
int check_compose(int first, int second);
|
||||
int decode_codepage(char *cp_name);
|
||||
|
2
scp.c
2
scp.c
@ -91,7 +91,7 @@ void logevent(char *string)
|
||||
{
|
||||
}
|
||||
|
||||
void ldisc_send(char *buf, int len)
|
||||
void ldisc_send(char *buf, int len, int interactive)
|
||||
{
|
||||
/*
|
||||
* This is only here because of the calls to ldisc_send(NULL,
|
||||
|
4
ssh.c
4
ssh.c
@ -2725,7 +2725,7 @@ static void ssh1_protocol(unsigned char *in, int inlen, int ispkt)
|
||||
if (eof_needed)
|
||||
ssh_special(TS_EOF);
|
||||
|
||||
ldisc_send(NULL, 0); /* cause ldisc to notice changes */
|
||||
ldisc_send(NULL, 0, 0); /* cause ldisc to notice changes */
|
||||
ssh_send_ok = 1;
|
||||
ssh_channels = newtree234(ssh_channelcmp);
|
||||
while (1) {
|
||||
@ -4636,7 +4636,7 @@ static void do_ssh2_authconn(unsigned char *in, int inlen, int ispkt)
|
||||
/*
|
||||
* Transfer data!
|
||||
*/
|
||||
ldisc_send(NULL, 0); /* cause ldisc to notice changes */
|
||||
ldisc_send(NULL, 0, 0); /* cause ldisc to notice changes */
|
||||
ssh_send_ok = 1;
|
||||
while (1) {
|
||||
static int try_send;
|
||||
|
2
telnet.c
2
telnet.c
@ -230,7 +230,7 @@ static void option_side_effects(struct Opt *o, int enabled)
|
||||
echoing = !enabled;
|
||||
else if (o->option == TELOPT_SGA && o->send == DO)
|
||||
editing = !enabled;
|
||||
ldisc_send(NULL, 0); /* cause ldisc to notice the change */
|
||||
ldisc_send(NULL, 0, 0); /* cause ldisc to notice the change */
|
||||
|
||||
/* Ensure we get the minimum options */
|
||||
if (!activated) {
|
||||
|
28
terminal.c
28
terminal.c
@ -292,7 +292,7 @@ static void power_on(void)
|
||||
big_cursor = 0;
|
||||
save_attr = curr_attr = ATTR_DEFAULT;
|
||||
term_editing = term_echoing = FALSE;
|
||||
ldisc_send(NULL, 0); /* cause ldisc to notice changes */
|
||||
ldisc_send(NULL, 0, 0); /* cause ldisc to notice changes */
|
||||
app_cursor_keys = cfg.app_cursor;
|
||||
app_keypad_keys = cfg.app_keypad;
|
||||
use_bce = cfg.bce;
|
||||
@ -902,7 +902,7 @@ static void toggle_mode(int mode, int query, int state)
|
||||
break;
|
||||
case 10: /* set local edit mode */
|
||||
term_editing = state;
|
||||
ldisc_send(NULL, 0); /* cause ldisc to notice changes */
|
||||
ldisc_send(NULL, 0, 0); /* cause ldisc to notice changes */
|
||||
break;
|
||||
case 25: /* enable/disable cursor */
|
||||
compatibility2(OTHER, VT220);
|
||||
@ -931,7 +931,7 @@ static void toggle_mode(int mode, int query, int state)
|
||||
break;
|
||||
case 12: /* set echo mode */
|
||||
term_echoing = !state;
|
||||
ldisc_send(NULL, 0); /* cause ldisc to notice changes */
|
||||
ldisc_send(NULL, 0, 0); /* cause ldisc to notice changes */
|
||||
break;
|
||||
case 20: /* Return sends ... */
|
||||
cr_lf_return = state;
|
||||
@ -1188,7 +1188,7 @@ void term_out(void)
|
||||
} else
|
||||
*d++ = *s;
|
||||
}
|
||||
lpage_send(CP_ACP, abuf, d - abuf);
|
||||
lpage_send(CP_ACP, abuf, d - abuf, 0);
|
||||
}
|
||||
break;
|
||||
case '\007':
|
||||
@ -1494,7 +1494,7 @@ void term_out(void)
|
||||
break;
|
||||
case 'Z': /* terminal type query */
|
||||
compatibility(VT100);
|
||||
ldisc_send(id_string, strlen(id_string));
|
||||
ldisc_send(id_string, strlen(id_string), 0);
|
||||
break;
|
||||
case 'c': /* restore power-on settings */
|
||||
compatibility(VT100);
|
||||
@ -1646,7 +1646,7 @@ void term_out(void)
|
||||
compatibility(OTHER);
|
||||
/* this reports xterm version 136 so that VIM can
|
||||
use the drag messages from the mouse reporting */
|
||||
ldisc_send("\033[>0;136;0c", 11);
|
||||
ldisc_send("\033[>0;136;0c", 11, 0);
|
||||
break;
|
||||
case 'a': /* move right N cols */
|
||||
compatibility(ANSI);
|
||||
@ -1742,16 +1742,16 @@ void term_out(void)
|
||||
case 'c': /* terminal type query */
|
||||
compatibility(VT100);
|
||||
/* This is the response for a VT102 */
|
||||
ldisc_send(id_string, strlen(id_string));
|
||||
ldisc_send(id_string, strlen(id_string), 0);
|
||||
break;
|
||||
case 'n': /* cursor position query */
|
||||
if (esc_args[0] == 6) {
|
||||
char buf[32];
|
||||
sprintf(buf, "\033[%d;%dR", curs.y + 1,
|
||||
curs.x + 1);
|
||||
ldisc_send(buf, strlen(buf));
|
||||
ldisc_send(buf, strlen(buf), 0);
|
||||
} else if (esc_args[0] == 5) {
|
||||
ldisc_send("\033[0n", 4);
|
||||
ldisc_send("\033[0n", 4, 0);
|
||||
}
|
||||
break;
|
||||
case 'h': /* toggle modes to high */
|
||||
@ -2011,7 +2011,7 @@ void term_out(void)
|
||||
if (i == 0 || i == 1) {
|
||||
strcpy(buf, "\033[2;1;1;112;112;1;0x");
|
||||
buf[2] += i;
|
||||
ldisc_send(buf, 20);
|
||||
ldisc_send(buf, 20, 0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -2328,7 +2328,7 @@ void term_out(void)
|
||||
termstate = VT52_Y1;
|
||||
break;
|
||||
case 'Z':
|
||||
ldisc_send("\033/Z", 3);
|
||||
ldisc_send("\033/Z", 3, 0);
|
||||
break;
|
||||
case '=':
|
||||
app_keypad_keys = TRUE;
|
||||
@ -3150,7 +3150,7 @@ void term_do_paste(void)
|
||||
|
||||
/* Assume a small paste will be OK in one go. */
|
||||
if (paste_len < 256) {
|
||||
luni_send(paste_buffer, paste_len);
|
||||
luni_send(paste_buffer, paste_len, 0);
|
||||
if (paste_buffer)
|
||||
sfree(paste_buffer);
|
||||
paste_buffer = 0;
|
||||
@ -3241,7 +3241,7 @@ void term_mouse(Mouse_Button b, Mouse_Action a, int x, int y,
|
||||
c = x + 33;
|
||||
|
||||
sprintf(abuf, "\033[M%c%c%c", encstate, c, r);
|
||||
ldisc_send(abuf, 6);
|
||||
ldisc_send(abuf, 6, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -3337,7 +3337,7 @@ void term_paste()
|
||||
if (paste_buffer[paste_pos + n++] == '\r')
|
||||
break;
|
||||
}
|
||||
luni_send(paste_buffer + paste_pos, n);
|
||||
luni_send(paste_buffer + paste_pos, n, 0);
|
||||
paste_pos += n;
|
||||
|
||||
if (paste_pos < paste_len) {
|
||||
|
14
unicode.c
14
unicode.c
@ -8,10 +8,6 @@
|
||||
#include "putty.h"
|
||||
#include "misc.h"
|
||||
|
||||
void init_ucs_tables(void);
|
||||
void lpage_send(int codepage, char *buf, int len);
|
||||
void luni_send(wchar_t * widebuf, int len);
|
||||
|
||||
static void get_unitab(int codepage, wchar_t * unitab, int ftype);
|
||||
|
||||
/* Character conversion arrays; they are usually taken from windows,
|
||||
@ -441,14 +437,14 @@ static void link_font(WCHAR * line_tbl, WCHAR * font_tbl, WCHAR attr)
|
||||
}
|
||||
}
|
||||
|
||||
void lpage_send(int codepage, char *buf, int len)
|
||||
void lpage_send(int codepage, char *buf, int len, int interactive)
|
||||
{
|
||||
static wchar_t *widebuffer = 0;
|
||||
static int widesize = 0;
|
||||
int wclen;
|
||||
|
||||
if (codepage < 0) {
|
||||
ldisc_send(buf, len);
|
||||
ldisc_send(buf, len, interactive);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -460,10 +456,10 @@ void lpage_send(int codepage, char *buf, int len)
|
||||
|
||||
wclen =
|
||||
MultiByteToWideChar(codepage, 0, buf, len, widebuffer, widesize);
|
||||
luni_send(widebuffer, wclen);
|
||||
luni_send(widebuffer, wclen, interactive);
|
||||
}
|
||||
|
||||
void luni_send(wchar_t * widebuf, int len)
|
||||
void luni_send(wchar_t * widebuf, int len, int interactive)
|
||||
{
|
||||
static char *linebuffer = 0;
|
||||
static int linesize = 0;
|
||||
@ -521,7 +517,7 @@ void luni_send(wchar_t * widebuf, int len)
|
||||
}
|
||||
}
|
||||
if (p > linebuffer)
|
||||
ldisc_send(linebuffer, p - linebuffer);
|
||||
ldisc_send(linebuffer, p - linebuffer, interactive);
|
||||
}
|
||||
|
||||
wchar_t xlat_uskbd2cyrllic(int ch)
|
||||
|
24
window.c
24
window.c
@ -1508,7 +1508,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
|
||||
* Flush the line discipline's edit buffer in the
|
||||
* case where local editing has just been disabled.
|
||||
*/
|
||||
ldisc_send(NULL, 0);
|
||||
ldisc_send(NULL, 0, 0);
|
||||
if (pal)
|
||||
DeleteObject(pal);
|
||||
logpal = NULL;
|
||||
@ -2150,7 +2150,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
|
||||
* messages. We _have_ to buffer everything
|
||||
* we're sent.
|
||||
*/
|
||||
ldisc_send(buf, len);
|
||||
ldisc_send(buf, len, 1);
|
||||
show_mouseptr(0);
|
||||
}
|
||||
}
|
||||
@ -2189,7 +2189,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
|
||||
if (n > 0) {
|
||||
buff = (char*) smalloc(n);
|
||||
ImmGetCompositionStringW(hIMC, GCS_RESULTSTR, buff, n);
|
||||
luni_send((unsigned short *)buff, n / 2);
|
||||
luni_send((unsigned short *)buff, n / 2, 1);
|
||||
free(buff);
|
||||
}
|
||||
ImmReleaseContext(hwnd, hIMC);
|
||||
@ -2202,10 +2202,10 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
|
||||
|
||||
buf[1] = wParam;
|
||||
buf[0] = wParam >> 8;
|
||||
lpage_send(kbd_codepage, buf, 2);
|
||||
lpage_send(kbd_codepage, buf, 2, 1);
|
||||
} else {
|
||||
char c = (unsigned char) wParam;
|
||||
lpage_send(kbd_codepage, &c, 1);
|
||||
lpage_send(kbd_codepage, &c, 1, 1);
|
||||
}
|
||||
return (0);
|
||||
case WM_CHAR:
|
||||
@ -2218,7 +2218,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
|
||||
*/
|
||||
{
|
||||
char c = (unsigned char)wParam;
|
||||
lpage_send(CP_ACP, &c, 1);
|
||||
lpage_send(CP_ACP, &c, 1, 1);
|
||||
}
|
||||
return 0;
|
||||
case WM_SETCURSOR:
|
||||
@ -3374,7 +3374,7 @@ static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam,
|
||||
return 0;
|
||||
}
|
||||
keybuf = nc;
|
||||
luni_send(&keybuf, 1);
|
||||
luni_send(&keybuf, 1, 1);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -3384,7 +3384,7 @@ static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam,
|
||||
if (alt_sum) {
|
||||
if (in_utf || dbcs_screenfont) {
|
||||
keybuf = alt_sum;
|
||||
luni_send(&keybuf, 1);
|
||||
luni_send(&keybuf, 1, 1);
|
||||
} else {
|
||||
ch = (char) alt_sum;
|
||||
/*
|
||||
@ -3396,22 +3396,22 @@ static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam,
|
||||
* messages. We _have_ to buffer
|
||||
* everything we're sent.
|
||||
*/
|
||||
ldisc_send(&ch, 1);
|
||||
ldisc_send(&ch, 1, 1);
|
||||
}
|
||||
alt_sum = 0;
|
||||
} else
|
||||
lpage_send(kbd_codepage, &ch, 1);
|
||||
lpage_send(kbd_codepage, &ch, 1, 1);
|
||||
} else {
|
||||
if(capsOn && ch < 0x80) {
|
||||
WCHAR cbuf[2];
|
||||
cbuf[0] = 27;
|
||||
cbuf[1] = xlat_uskbd2cyrllic(ch);
|
||||
luni_send(cbuf+!left_alt, 1+!!left_alt);
|
||||
luni_send(cbuf+!left_alt, 1+!!left_alt, 1);
|
||||
} else {
|
||||
char cbuf[2];
|
||||
cbuf[0] = '\033';
|
||||
cbuf[1] = ch;
|
||||
lpage_send(kbd_codepage, cbuf+!left_alt, 1+!!left_alt);
|
||||
lpage_send(kbd_codepage, cbuf+!left_alt, 1+!!left_alt, 1);
|
||||
}
|
||||
}
|
||||
show_mouseptr(0);
|
||||
|
Loading…
Reference in New Issue
Block a user