mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-04-17 19:18:06 -05:00
Implement the ldisc `special' mechanism in Unix, without which local
line editing didn't work at all. [originally from svn r3107]
This commit is contained in:
parent
09f7a8edbf
commit
56a4e967da
24
unix/pterm.c
24
unix/pterm.c
@ -427,7 +427,7 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data)
|
|||||||
{
|
{
|
||||||
struct gui_data *inst = (struct gui_data *)data;
|
struct gui_data *inst = (struct gui_data *)data;
|
||||||
char output[32];
|
char output[32];
|
||||||
int start, end;
|
int start, end, special;
|
||||||
|
|
||||||
/* By default, nothing is generated. */
|
/* By default, nothing is generated. */
|
||||||
end = start = 0;
|
end = start = 0;
|
||||||
@ -551,6 +551,8 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
special = FALSE;
|
||||||
|
|
||||||
/* ALT+things gives leading Escape. */
|
/* ALT+things gives leading Escape. */
|
||||||
output[0] = '\033';
|
output[0] = '\033';
|
||||||
strncpy(output+1, event->string, 31);
|
strncpy(output+1, event->string, 31);
|
||||||
@ -574,6 +576,15 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data)
|
|||||||
(event->state & GDK_CONTROL_MASK)) {
|
(event->state & GDK_CONTROL_MASK)) {
|
||||||
output[1] = '\003';
|
output[1] = '\003';
|
||||||
end = 2;
|
end = 2;
|
||||||
|
special = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* We handle Return ourselves, because it needs to be flagged as
|
||||||
|
* special to ldisc. */
|
||||||
|
if (event->keyval == GDK_Return) {
|
||||||
|
output[1] = '\015';
|
||||||
|
end = 2;
|
||||||
|
special = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Control-2, Control-Space and Control-@ are NUL */
|
/* Control-2, Control-Space and Control-@ are NUL */
|
||||||
@ -599,12 +610,14 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data)
|
|||||||
!(event->state & GDK_SHIFT_MASK)) {
|
!(event->state & GDK_SHIFT_MASK)) {
|
||||||
output[1] = inst->cfg.bksp_is_delete ? '\x7F' : '\x08';
|
output[1] = inst->cfg.bksp_is_delete ? '\x7F' : '\x08';
|
||||||
end = 2;
|
end = 2;
|
||||||
|
special = TRUE;
|
||||||
}
|
}
|
||||||
/* For Shift Backspace, do opposite of what is configured. */
|
/* For Shift Backspace, do opposite of what is configured. */
|
||||||
if (event->keyval == GDK_BackSpace &&
|
if (event->keyval == GDK_BackSpace &&
|
||||||
(event->state & GDK_SHIFT_MASK)) {
|
(event->state & GDK_SHIFT_MASK)) {
|
||||||
output[1] = inst->cfg.bksp_is_delete ? '\x08' : '\x7F';
|
output[1] = inst->cfg.bksp_is_delete ? '\x08' : '\x7F';
|
||||||
end = 2;
|
end = 2;
|
||||||
|
special = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Shift-Tab is ESC [ Z */
|
/* Shift-Tab is ESC [ Z */
|
||||||
@ -910,7 +923,14 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data)
|
|||||||
printf("\n");
|
printf("\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!inst->direct_to_font) {
|
if (special) {
|
||||||
|
/*
|
||||||
|
* For special control characters, the character set
|
||||||
|
* should never matter.
|
||||||
|
*/
|
||||||
|
output[end] = '\0'; /* NUL-terminate */
|
||||||
|
ldisc_send(inst->ldisc, output+start, -2, 1);
|
||||||
|
} else if (!inst->direct_to_font) {
|
||||||
/*
|
/*
|
||||||
* The stuff we've just generated is assumed to be
|
* The stuff we've just generated is assumed to be
|
||||||
* ISO-8859-1! This sounds insane, but `man
|
* ISO-8859-1! This sounds insane, but `man
|
||||||
|
Loading…
x
Reference in New Issue
Block a user