Commit 2949c513 authored by Nalin Dahyabhai's avatar Nalin Dahyabhai

add. add. add. add. add. expand "%m" locally so that we can distinguish

* src/vte.c(vte_terminal_sequence_handler_scroll_up_or_down): add.
* src/vte.c(vte_terminal_sequence_handler_scroll_up_once): add.
* src/vte.c(vte_terminal_sequence_handler_scroll_down_once): add.
* src/vte.c(vte_terminal_sequence_handler_scroll_up): add.
* src/vte.c(vte_terminal_sequence_handler_scroll_down): add.
* src/table.c(_vte_table_addi): expand "%m" locally so that we can distinguish
	between control sequences which differ only in the number of numeric
	arguments they expect.  This means we have a new upper limit on the
	length of a numeric argument list we'll recognize.
* src/caps.c(_vte_xterm_capability_strings): remove alternates for strings
	which include '%m' as a specifier -- that's handled at the matching
	layer now.
* src/vte.c(vte_terminal_paste_cb): drop the supplied data if it isn't valid
	UTF-8 (Red Hat #119099).
* src/keymap.c(_vte_keymap_map): try xterm variants if we're xterm, not the
	other way around.
parent 2f99b80d
2004-11-16 nalin
* src/vte.c(vte_terminal_sequence_handler_scroll_up_or_down): add.
* src/vte.c(vte_terminal_sequence_handler_scroll_up_once): add.
* src/vte.c(vte_terminal_sequence_handler_scroll_down_once): add.
* src/vte.c(vte_terminal_sequence_handler_scroll_up): add.
* src/vte.c(vte_terminal_sequence_handler_scroll_down): add.
* src/table.c(_vte_table_addi): expand "%m" locally so that we can
distinguish between control sequences which differ only in the number
of numeric arguments they expect. This means we have a new upper
limit on the length of a numeric argument list we'll recognize.
* src/caps.c(_vte_xterm_capability_strings): remove alternates for
strings which include '%m' as a specifier -- that's handled at the
matching layer now.
* src/vte.c(vte_terminal_paste_cb): drop the supplied data if it isn't
valid UTF-8 (Red Hat #119099).
* src/keymap.c(_vte_keymap_map): try xterm variants if we're xterm, not
the other way around.
2004-08-18 David Lodge <dave@cirt.net>
* configure.in: Added "ang" to ALL_LINGUAS.
......
......@@ -469,7 +469,6 @@ struct _vte_capability_string _vte_xterm_capability_strings[] = {
{CSI ">%dc", "send-secondary-device-attributes", 0},
{CSI "=c", "send-tertiary-device-attributes", 0},
{CSI "=%dc", "send-tertiary-device-attributes", 0},
{CSI "?c", "linux-console-cursor-attributes", 0},
{CSI "?%mc", "linux-console-cursor-attributes", 0},
{CSI "d", "line-position-absolute", 0},
{CSI "%dd", "line-position-absolute", 0},
......@@ -480,22 +479,15 @@ struct _vte_capability_string _vte_xterm_capability_strings[] = {
{CSI "g", "tab-clear", 0},
{CSI "%dg", "tab-clear", 0},
{CSI "h", "set-mode", 0},
{CSI "%mh", "set-mode", 0},
{CSI "?h", "decset", 0},
{CSI "?%mh", "decset", 0},
{CSI "i", "media-copy", 0},
{CSI "%mi", "media-copy", 0},
{CSI "?i", "dec-media-copy", 0},
{CSI "?%mi", "dec-media-copy", 0},
{CSI "l", "reset-mode", 0},
{CSI "%ml", "reset-mode", 0},
{CSI "?l", "decreset", 0},
{CSI "?%ml", "decreset", 0},
{CSI "m", "character-attributes", 0},
{CSI "%mm", "character-attributes", 0},
{CSI "%dn", "device-status-report", 0},
......@@ -505,9 +497,7 @@ struct _vte_capability_string _vte_xterm_capability_strings[] = {
{CSI "%d\"q", "select-character-protection", 0},
{CSI "r", "set-scrolling-region", 0},
{CSI "%d;%dr", "set-scrolling-region", 0},
{CSI "?r", "restore-mode", 0},
{CSI "?%mr", "restore-mode", 0},
{CSI "?s", "save-mode", 0},
{CSI "?%ms", "save-mode", 0},
{CSI "%mt", "window-manipulation", 0},
......
......@@ -1149,7 +1149,7 @@ _vte_keymap_map(guint keyval,
tmp = g_strdup(termcap_special);
cap = tgetstr(tmp, &cap);
}
if ((cap == NULL) && (strstr(terminal, "xterm") == 0)) {
if ((cap == NULL) && (strstr(terminal, "xterm") != NULL)) {
/* try, try again */
if (tgetent(ncurses_buffer, "xterm-xfree86") == 1) {
cap = ncurses_area;
......
This diff is collapsed.
......@@ -424,6 +424,8 @@ static gboolean vte_sequence_handler_nd(VteTerminal *terminal,
const char *match,
GQuark match_quark,
GValueArray *params);
static gboolean vte_sequence_handler_scroll_up_or_down(VteTerminal *terminal,
int scroll_amount);
static gboolean vte_sequence_handler_sf(VteTerminal *terminal,
const char *match,
GQuark match_quark,
......@@ -678,7 +680,8 @@ vte_invalidate_all(VteTerminal *terminal)
gdk_window_invalidate_rect(widget->window, &rect, FALSE);
}
/* Scroll a rectangular region up or down by a fixed number of lines. */
/* Scroll a rectangular region up or down by a fixed number of lines,
* negative = up, positive = down. */
static void
vte_terminal_scroll_region(VteTerminal *terminal,
long row, glong count, glong delta)
......@@ -3436,6 +3439,99 @@ vte_sequence_handler_sc(VteTerminal *terminal,
return FALSE;
}
/* Scroll the text down one line, but don't move the cursor. */
static gboolean
vte_sequence_handler_scroll_down_one(VteTerminal *terminal,
const char *match,
GQuark match_quark,
GValueArray *params)
{
return vte_sequence_handler_scroll_up_or_down(terminal, 1);
}
/* Scroll the text down, but don't move the cursor. */
static gboolean
vte_sequence_handler_scroll_down(VteTerminal *terminal,
const char *match,
GQuark match_quark,
GValueArray *params)
{
return vte_sequence_handler_multiple(terminal, match, match_quark,
params, vte_sequence_handler_scroll_down_one);
}
/* Scroll the text, but don't move the cursor. Negative = up,
* positive = down. */
static gboolean
vte_sequence_handler_scroll_up_or_down(VteTerminal *terminal, int scroll_amount)
{
GtkWidget *widget;
VteRowData *row;
long start, end, i;
VteScreen *screen;
widget = GTK_WIDGET(terminal);
screen = terminal->pvt->screen;
if (screen->scrolling_restricted) {
start = screen->insert_delta + screen->scrolling_region.start;
end = screen->insert_delta + screen->scrolling_region.end;
} else {
start = screen->insert_delta;
end = start + terminal->row_count - 1;
}
while (_vte_ring_next(screen->row_data) <= end) {
row = vte_new_row_data_sized(terminal, FALSE);
_vte_ring_append(terminal->pvt->screen->row_data, row);
}
if (scroll_amount > 0) {
for (i = 0; i < scroll_amount; i++) {
vte_remove_line_internal(terminal, end);
vte_insert_line_internal(terminal, start);
}
} else {
for (i = 0; i < -scroll_amount; i++) {
vte_remove_line_internal(terminal, start);
vte_insert_line_internal(terminal, end);
}
}
/* Update the display. */
vte_terminal_scroll_region(terminal, start, end - start + 1,
scroll_amount);
/* Adjust the scrollbars if necessary. */
vte_terminal_adjust_adjustments(terminal, FALSE);
/* We've modified the display. Make a note of it. */
terminal->pvt->text_inserted_count++;
terminal->pvt->text_deleted_count++;
return FALSE;
}
/* Scroll the text up one line, but don't move the cursor. */
static gboolean
vte_sequence_handler_scroll_up_one(VteTerminal *terminal,
const char *match,
GQuark match_quark,
GValueArray *params)
{
return vte_sequence_handler_scroll_up_or_down(terminal, -1);
}
/* Scroll the text up, but don't move the cursor. */
static gboolean
vte_sequence_handler_scroll_up(VteTerminal *terminal,
const char *match,
GQuark match_quark,
GValueArray *params)
{
return vte_sequence_handler_multiple(terminal, match, match_quark,
params, vte_sequence_handler_scroll_up_one);
}
/* Standout end. */
static gboolean
vte_sequence_handler_se(VteTerminal *terminal,
......@@ -6243,8 +6339,8 @@ static struct {
{"save-cursor", vte_sequence_handler_sc},
{"save-mode", vte_sequence_handler_save_mode},
{"screen-alignment-test", vte_sequence_handler_screen_alignment_test},
{"scroll-down", NULL},
{"scroll-up", NULL},
{"scroll-down", vte_sequence_handler_scroll_down},
{"scroll-up", vte_sequence_handler_scroll_up},
{"select-character-protection", NULL},
{"selective-erase-in-display", NULL},
{"selective-erase-in-line", NULL},
......@@ -8816,6 +8912,11 @@ vte_terminal_paste_cb(GtkClipboard *clipboard, const gchar *text, gpointer data)
strlen(text));
}
#endif
if (!g_utf8_validate(text, -1, NULL)) {
g_warning(_("Error (%s) converting data for child, dropping."), strerror(EINVAL));
return;
}
/* Convert newlines to carriage returns, which more software
* is able to cope with (cough, pico, cough). */
paste = g_strdup(text);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment