[vte] emulation: Migrating from terminfo: insert and erase operations
- From: Egmont Koblinger <egmontkob src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vte] emulation: Migrating from terminfo: insert and erase operations
- Date: Mon, 19 May 2014 13:09:28 +0000 (UTC)
commit 7ba12a5095403ee4a131f50bac6425b918077132
Author: Egmont Koblinger <egmont gmail com>
Date: Mon May 19 14:52:36 2014 +0200
emulation: Migrating from terminfo: insert and erase operations
Hardwire the behavior of insert and erase operations, rather than relying
on terminfo.
src/vteseq-2.gperf | 18 ++++----
src/vteseq-n.gperf | 2 +-
src/vteseq.c | 134 ++++------------------------------------------------
3 files changed, 19 insertions(+), 135 deletions(-)
---
diff --git a/src/vteseq-2.gperf b/src/vteseq-2.gperf
index 5198f6d..0ae159f 100644
--- a/src/vteseq-2.gperf
+++ b/src/vteseq-2.gperf
@@ -73,9 +73,9 @@ struct vteseq_2_struct {
#"@7", VTE_SEQUENCE_HANDLER(vte_sequence_handler_complain_key)
#"@8", VTE_SEQUENCE_HANDLER(vte_sequence_handler_complain_key)
#"@9", VTE_SEQUENCE_HANDLER(vte_sequence_handler_complain_key)
-"AL", VTE_SEQUENCE_HANDLER(vte_sequence_handler_AL)
-"DC", VTE_SEQUENCE_HANDLER(vte_sequence_handler_DC)
-"DL", VTE_SEQUENCE_HANDLER(vte_sequence_handler_DL)
+#"AL", VTE_SEQUENCE_HANDLER(vte_sequence_handler_AL)
+#"DC", VTE_SEQUENCE_HANDLER(vte_sequence_handler_DC)
+#"DL", VTE_SEQUENCE_HANDLER(vte_sequence_handler_DL)
#"DO", VTE_SEQUENCE_HANDLER(vte_sequence_handler_DO)
#"F1", VTE_SEQUENCE_HANDLER(vte_sequence_handler_complain_key)
#"F2", VTE_SEQUENCE_HANDLER(vte_sequence_handler_complain_key)
@@ -130,7 +130,7 @@ struct vteseq_2_struct {
#"Fp", VTE_SEQUENCE_HANDLER(vte_sequence_handler_complain_key)
#"Fq", VTE_SEQUENCE_HANDLER(vte_sequence_handler_complain_key)
#"Fr", VTE_SEQUENCE_HANDLER(vte_sequence_handler_complain_key)
-"IC", VTE_SEQUENCE_HANDLER(vte_sequence_handler_IC)
+#"IC", VTE_SEQUENCE_HANDLER(vte_sequence_handler_IC)
#"K1", VTE_SEQUENCE_HANDLER(vte_sequence_handler_complain_key)
#"K2", VTE_SEQUENCE_HANDLER(vte_sequence_handler_complain_key)
#"K3", VTE_SEQUENCE_HANDLER(vte_sequence_handler_complain_key)
@@ -153,7 +153,7 @@ struct vteseq_2_struct {
#"UP", VTE_SEQUENCE_HANDLER(vte_sequence_handler_UP)
#"XF", VTE_SEQUENCE_HANDLER_NULL
"ae", VTE_SEQUENCE_HANDLER(vte_sequence_handler_ae)
-"al", VTE_SEQUENCE_HANDLER(vte_sequence_handler_al)
+#"al", VTE_SEQUENCE_HANDLER(vte_sequence_handler_al)
"as", VTE_SEQUENCE_HANDLER(vte_sequence_handler_as)
#"bc", VTE_SEQUENCE_HANDLER(vte_sequence_handler_le)
#"bl", VTE_SEQUENCE_HANDLER(vte_sequence_handler_bl)
@@ -170,13 +170,13 @@ struct vteseq_2_struct {
"cs", VTE_SEQUENCE_HANDLER(vte_sequence_handler_cs)
#"ct", VTE_SEQUENCE_HANDLER(vte_sequence_handler_ct)
#"cv", VTE_SEQUENCE_HANDLER(vte_sequence_handler_cv)
-"dc", VTE_SEQUENCE_HANDLER(vte_sequence_handler_dc)
-"dl", VTE_SEQUENCE_HANDLER(vte_sequence_handler_dl)
+#"dc", VTE_SEQUENCE_HANDLER(vte_sequence_handler_dc)
+#"dl", VTE_SEQUENCE_HANDLER(vte_sequence_handler_dl)
"dm", VTE_SEQUENCE_HANDLER(vte_sequence_handler_noop)
#"do", VTE_SEQUENCE_HANDLER(vte_sequence_handler_do)
#"ds", VTE_SEQUENCE_HANDLER_NULL
"eA", VTE_SEQUENCE_HANDLER(vte_sequence_handler_eA)
-"ec", VTE_SEQUENCE_HANDLER(vte_sequence_handler_ec)
+#"ec", VTE_SEQUENCE_HANDLER(vte_sequence_handler_ec)
"ed", VTE_SEQUENCE_HANDLER(vte_sequence_handler_noop)
"ei", VTE_SEQUENCE_HANDLER(vte_sequence_handler_ei)
"ff", VTE_SEQUENCE_HANDLER(vte_sequence_handler_noop)
@@ -187,7 +187,7 @@ struct vteseq_2_struct {
#"i1", VTE_SEQUENCE_HANDLER_NULL
#"i3", VTE_SEQUENCE_HANDLER_NULL
#"iP", VTE_SEQUENCE_HANDLER_NULL
-"ic", VTE_SEQUENCE_HANDLER(vte_sequence_handler_ic)
+#"ic", VTE_SEQUENCE_HANDLER(vte_sequence_handler_ic)
#"if", VTE_SEQUENCE_HANDLER_NULL
"im", VTE_SEQUENCE_HANDLER(vte_sequence_handler_im)
#"ip", VTE_SEQUENCE_HANDLER_NULL
diff --git a/src/vteseq-n.gperf b/src/vteseq-n.gperf
index f95f813..1cb2e7d 100644
--- a/src/vteseq-n.gperf
+++ b/src/vteseq-n.gperf
@@ -78,7 +78,7 @@ struct vteseq_n_struct {
"erase-in-display", VTE_SEQUENCE_HANDLER(vte_sequence_handler_erase_in_display)
"set-window-title", VTE_SEQUENCE_HANDLER(vte_sequence_handler_set_window_title)
#"cursor-lower-left", VTE_SEQUENCE_HANDLER_NULL
-"delete-characters", VTE_SEQUENCE_HANDLER(vte_sequence_handler_DC)
+"delete-characters", VTE_SEQUENCE_HANDLER(vte_sequence_handler_delete_characters)
"application-keypad", VTE_SEQUENCE_HANDLER(vte_sequence_handler_application_keypad)
#"change-font-number", VTE_SEQUENCE_HANDLER_NULL
"return-terminal-id", VTE_SEQUENCE_HANDLER(vte_sequence_handler_return_terminal_id)
diff --git a/src/vteseq.c b/src/vteseq.c
index e896a87..cccc525 100644
--- a/src/vteseq.c
+++ b/src/vteseq.c
@@ -932,56 +932,6 @@ vte_sequence_handler_ae (VteTerminal *terminal, GValueArray *params)
terminal->pvt->screen->alternate_charset = FALSE;
}
-/* Add a line at the current cursor position. */
-static void
-vte_sequence_handler_al (VteTerminal *terminal, GValueArray *params)
-{
- VteScreen *screen;
- long start, end, param, i;
- GValue *value;
-
- /* Find out which part of the screen we're messing with. */
- screen = terminal->pvt->screen;
- start = screen->cursor_current.row;
- if (screen->scrolling_restricted) {
- end = screen->insert_delta + screen->scrolling_region.end;
- } else {
- end = screen->insert_delta + terminal->pvt->row_count - 1;
- }
-
- /* Extract any parameters. */
- param = 1;
- if ((params != NULL) && (params->n_values > 0)) {
- value = g_value_array_get_nth(params, 0);
- if (G_VALUE_HOLDS_LONG(value)) {
- param = g_value_get_long(value);
- }
- }
-
- /* Insert the right number of lines. */
- for (i = 0; i < param; i++) {
- /* Clear a line off the end of the region and add one to the
- * top of the region. */
- _vte_terminal_ring_remove (terminal, end);
- _vte_terminal_ring_insert (terminal, start, TRUE);
- /* Adjust the scrollbars if necessary. */
- _vte_terminal_adjust_adjustments(terminal);
- }
-
- /* Update the display. */
- _vte_terminal_scroll_region(terminal, start, end - start + 1, param);
-
- /* We've modified the display. Make a note of it. */
- terminal->pvt->text_deleted_flag = TRUE;
-}
-
-/* Add N lines at the current cursor position. */
-static void
-vte_sequence_handler_AL (VteTerminal *terminal, GValueArray *params)
-{
- vte_sequence_handler_al (terminal, params);
-}
-
/* Start using alternate character set. */
static void
vte_sequence_handler_as (VteTerminal *terminal, GValueArray *params)
@@ -1349,7 +1299,7 @@ vte_sequence_handler_line_position_absolute (VteTerminal *terminal, GValueArray
/* Delete a character at the current cursor position. */
static void
-vte_sequence_handler_dc (VteTerminal *terminal, GValueArray *params)
+_vte_sequence_handler_dc (VteTerminal *terminal, GValueArray *params)
{
VteScreen *screen;
VteRowData *rowdata;
@@ -1384,59 +1334,9 @@ vte_sequence_handler_dc (VteTerminal *terminal, GValueArray *params)
/* Delete N characters at the current cursor position. */
static void
-vte_sequence_handler_DC (VteTerminal *terminal, GValueArray *params)
-{
- vte_sequence_handler_multiple_r(terminal, params, vte_sequence_handler_dc);
-}
-
-/* Delete a line at the current cursor position. */
-static void
-vte_sequence_handler_dl (VteTerminal *terminal, GValueArray *params)
-{
- VteScreen *screen;
- long start, end, param, i;
- GValue *value;
-
- /* Find out which part of the screen we're messing with. */
- screen = terminal->pvt->screen;
- start = screen->cursor_current.row;
- if (screen->scrolling_restricted) {
- end = screen->insert_delta + screen->scrolling_region.end;
- } else {
- end = screen->insert_delta + terminal->pvt->row_count - 1;
- }
-
- /* Extract any parameters. */
- param = 1;
- if ((params != NULL) && (params->n_values > 0)) {
- value = g_value_array_get_nth(params, 0);
- if (G_VALUE_HOLDS_LONG(value)) {
- param = g_value_get_long(value);
- }
- }
-
- /* Delete the right number of lines. */
- for (i = 0; i < param; i++) {
- /* Clear a line off the end of the region and add one to the
- * top of the region. */
- _vte_terminal_ring_remove (terminal, start);
- _vte_terminal_ring_insert (terminal, end, TRUE);
- /* Adjust the scrollbars if necessary. */
- _vte_terminal_adjust_adjustments(terminal);
- }
-
- /* Update the display. */
- _vte_terminal_scroll_region(terminal, start, end - start + 1, -param);
-
- /* We've modified the display. Make a note of it. */
- terminal->pvt->text_deleted_flag = TRUE;
-}
-
-/* Delete N lines at the current cursor position. */
-static void
-vte_sequence_handler_DL (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_delete_characters (VteTerminal *terminal, GValueArray *params)
{
- vte_sequence_handler_dl (terminal, params);
+ vte_sequence_handler_multiple_r(terminal, params, _vte_sequence_handler_dc);
}
/* Cursor down N lines, no scrolling. */
@@ -1478,7 +1378,7 @@ vte_sequence_handler_eA (VteTerminal *terminal, GValueArray *params)
/* Erase characters starting at the cursor position (overwriting N with
* spaces, but not moving the cursor). */
static void
-vte_sequence_handler_ec (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_erase_characters (VteTerminal *terminal, GValueArray *params)
{
VteScreen *screen;
VteRowData *rowdata;
@@ -1541,9 +1441,9 @@ vte_sequence_handler_form_feed (VteTerminal *terminal, GValueArray *params)
vte_sequence_handler_line_feed (terminal, params);
}
-/* Insert a character. */
+/* Insert a blank character. */
static void
-vte_sequence_handler_ic (VteTerminal *terminal, GValueArray *params)
+_vte_sequence_handler_insert_character (VteTerminal *terminal, GValueArray *params)
{
VteVisualPosition save;
VteScreen *screen;
@@ -1557,11 +1457,11 @@ vte_sequence_handler_ic (VteTerminal *terminal, GValueArray *params)
screen->cursor_current = save;
}
-/* Insert N characters. */
+/* Insert N blank characters. */
static void
-vte_sequence_handler_IC (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_insert_blank_characters (VteTerminal *terminal, GValueArray *params)
{
- vte_sequence_handler_multiple_r(terminal, params, vte_sequence_handler_ic);
+ vte_sequence_handler_multiple_r(terminal, params, _vte_sequence_handler_insert_character);
}
/* Begin insert mode. */
@@ -2637,11 +2537,9 @@ vte_sequence_handler_normal_keypad (VteTerminal *terminal, GValueArray *params)
static void
vte_sequence_handler_character_position_absolute (VteTerminal *terminal, GValueArray *params)
{
- VteScreen *screen;
GValue *value;
long val;
- screen = terminal->pvt->screen;
/* We only care if there's a parameter in there. */
if ((params != NULL) && (params->n_values > 0)) {
value = g_value_array_get_nth(params, 0);
@@ -2734,13 +2632,6 @@ vte_sequence_handler_decreset (VteTerminal *terminal, GValueArray *params)
}
}
-/* Erase a specified number of characters. */
-static void
-vte_sequence_handler_erase_characters (VteTerminal *terminal, GValueArray *params)
-{
- vte_sequence_handler_ec (terminal, params);
-}
-
/* Erase certain lines in the display. */
static void
vte_sequence_handler_erase_in_display (VteTerminal *terminal, GValueArray *params)
@@ -2827,13 +2718,6 @@ vte_sequence_handler_full_reset (VteTerminal *terminal, GValueArray *params)
vte_terminal_reset(terminal, TRUE, TRUE);
}
-/* Insert a specified number of blank characters. */
-static void
-vte_sequence_handler_insert_blank_characters (VteTerminal *terminal, GValueArray *params)
-{
- vte_sequence_handler_IC (terminal, params);
-}
-
/* Insert a certain number of lines below the current cursor. */
static void
vte_sequence_handler_insert_lines (VteTerminal *terminal, GValueArray *params)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]