#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;
/*
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
{
}
-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,
* 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.
#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);
{
}
-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,
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) {
/*
* 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;
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) {
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;
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);
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;
} else
*d++ = *s;
}
- lpage_send(CP_ACP, abuf, d - abuf);
+ lpage_send(CP_ACP, abuf, d - abuf, 0);
}
break;
case '\007':
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);
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);
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 */
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;
termstate = VT52_Y1;
break;
case 'Z':
- ldisc_send("\033/Z", 3);
+ ldisc_send("\033/Z", 3, 0);
break;
case '=':
app_keypad_keys = TRUE;
/* 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;
c = x + 33;
sprintf(abuf, "\033[M%c%c%c", encstate, c, r);
- ldisc_send(abuf, 6);
+ ldisc_send(abuf, 6, 0);
return;
}
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) {
#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,
}
}
-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;
}
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;
}
}
if (p > linebuffer)
- ldisc_send(linebuffer, p - linebuffer);
+ ldisc_send(linebuffer, p - linebuffer, interactive);
}
wchar_t xlat_uskbd2cyrllic(int ch)
* 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;
* messages. We _have_ to buffer everything
* we're sent.
*/
- ldisc_send(buf, len);
+ ldisc_send(buf, len, 1);
show_mouseptr(0);
}
}
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);
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:
*/
{
char c = (unsigned char)wParam;
- lpage_send(CP_ACP, &c, 1);
+ lpage_send(CP_ACP, &c, 1, 1);
}
return 0;
case WM_SETCURSOR:
return 0;
}
keybuf = nc;
- luni_send(&keybuf, 1);
+ luni_send(&keybuf, 1, 1);
continue;
}
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;
/*
* 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);