[vte/vte-next: 173/223] Move vteseq.c methods to VteBuffer
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vte/vte-next: 173/223] Move vteseq.c methods to VteBuffer
- Date: Wed, 22 Jun 2011 21:03:08 +0000 (UTC)
commit 0443e7d7556f3c79c802f63a8be7c6eb34e9e885
Author: Christian Persch <chpe gnome org>
Date: Sun Jun 12 15:13:46 2011 +0200
Move vteseq.c methods to VteBuffer
src/vte-private.h | 9 +-
src/vte.c | 2 +-
src/vteseq.c | 1072 ++++++++++++++++++++++++++---------------------------
3 files changed, 530 insertions(+), 553 deletions(-)
---
diff --git a/src/vte-private.h b/src/vte-private.h
index 28f091f..8eb073e 100644
--- a/src/vte-private.h
+++ b/src/vte-private.h
@@ -442,11 +442,6 @@ void _vte_terminal_beep(VteTerminal *terminal);
void _vte_terminal_inline_error_message(VteTerminal *terminal, const char *format, ...) G_GNUC_PRINTF(2,3);
-/* vteseq.c: */
-void _vte_terminal_handle_sequence(VteTerminal *terminal,
- const char *match_s,
- GQuark match,
- GValueArray *params);
gboolean _vte_terminal_xy_to_grid(VteTerminal *terminal,
long x,
long y,
@@ -492,6 +487,10 @@ void _vte_buffer_emit_resize_window(VteBuffer *buffer, guint w, guint h);
void _vte_buffer_emit_move_window(VteBuffer *buffer, guint x, guint y);
void _vte_buffer_emit_text_deleted(VteBuffer *buffer);
void _vte_buffer_emit_text_inserted(VteBuffer *buffer);
+void _vte_terminal_handle_sequence(VteBuffer *buffer,
+ const char *match_s,
+ GQuark match,
+ GValueArray *params);
/* private VteScreen methods */
void _vte_screen_set_default_attributes(VteScreen *screen);
diff --git a/src/vte.c b/src/vte.c
index 22e799d..3e38071 100644
--- a/src/vte.c
+++ b/src/vte.c
@@ -3296,7 +3296,7 @@ skip_chunk:
if ((match != NULL) && (match[0] != '\0')) {
/* Call the right sequence handler for the requested
* behavior. */
- _vte_terminal_handle_sequence(terminal,
+ _vte_terminal_handle_sequence(terminal->term_pvt->buffer,
match,
quark,
params);
diff --git a/src/vteseq.c b/src/vteseq.c
index 5173bb5..032ec35 100644
--- a/src/vteseq.c
+++ b/src/vteseq.c
@@ -32,17 +32,8 @@
#define BEL "\007"
-/* FIXMEchpe hackery remove later */
-static inline void vte_terminal_feed_child(VteTerminal *terminal, const char *data, gssize len)
-{
- vte_buffer_feed_child(terminal->term_pvt->buffer, data, len);
-}
-
-
/* FUNCTIONS WE USE */
-
-
static void
display_control_sequence(const char *name, GValueArray *params)
{
@@ -343,7 +334,7 @@ vte_buffer_termcap_string_same_as_for (VteBuffer *buffer,
/* Set icon/window titles. */
static void
-vte_sequence_handler_set_title_internal(VteTerminal *terminal,
+vte_sequence_handler_set_title_internal(VteBuffer *buffer,
GValueArray *params,
gboolean icon_title,
gboolean window_title)
@@ -366,7 +357,7 @@ vte_sequence_handler_set_title_internal(VteTerminal *terminal,
title = g_value_dup_string(value);
} else
if (G_VALUE_HOLDS_POINTER(value)) {
- title = vte_buffer_ucs4_to_utf8(terminal->term_pvt->buffer, g_value_get_pointer (value));
+ title = vte_buffer_ucs4_to_utf8(buffer, g_value_get_pointer (value));
}
if (title != NULL) {
char *p, *validated;
@@ -385,13 +376,13 @@ vte_sequence_handler_set_title_internal(VteTerminal *terminal,
/* Emit the signal */
if (window_title) {
- g_free (terminal->pvt->window_title_changed);
- terminal->pvt->window_title_changed = g_strdup (validated);
+ g_free (buffer->pvt->window_title_changed);
+ buffer->pvt->window_title_changed = g_strdup (validated);
}
if (icon_title) {
- g_free (terminal->pvt->icon_title_changed);
- terminal->pvt->icon_title_changed = g_strdup (validated);
+ g_free (buffer->pvt->icon_title_changed);
+ buffer->pvt->icon_title_changed = g_strdup (validated);
}
g_free (validated);
@@ -402,20 +393,20 @@ vte_sequence_handler_set_title_internal(VteTerminal *terminal,
/* Toggle a terminal mode. */
static void
-vte_sequence_handler_set_mode_internal(VteTerminal *terminal,
+vte_sequence_handler_set_mode_internal(VteBuffer *buffer,
long setting, gboolean value)
{
switch (setting) {
case 2: /* keyboard action mode (?) */
break;
case 4: /* insert/overtype mode */
- terminal->pvt->screen->insert_mode = value;
+ buffer->pvt->screen->insert_mode = value;
break;
case 12: /* send/receive mode (local echo) */
- terminal->pvt->screen->sendrecv_mode = value;
+ buffer->pvt->screen->sendrecv_mode = value;
break;
case 20: /* automatic newline / normal linefeed mode */
- terminal->pvt->screen->linefeed_mode = value;
+ buffer->pvt->screen->linefeed_mode = value;
break;
default:
break;
@@ -428,11 +419,11 @@ vte_sequence_handler_set_mode_internal(VteTerminal *terminal,
*/
/* Typedef the handle type */
-typedef void (*VteSequenceHandler) (VteTerminal *terminal, GValueArray *params);
+typedef void (*VteSequenceHandler) (VteBuffer *buffer, GValueArray *params);
/* Prototype all handlers... */
#define VTE_SEQUENCE_HANDLER(name) \
- static void name (VteTerminal *terminal, GValueArray *params);
+ static void name (VteBuffer *buffer, GValueArray *params);
#include "vteseq-list.h"
#undef VTE_SEQUENCE_HANDLER
@@ -440,7 +431,7 @@ typedef void (*VteSequenceHandler) (VteTerminal *terminal, GValueArray *params);
/* Call another handler, offsetting any long arguments by the given
* increment value. */
static void
-vte_sequence_handler_offset(VteTerminal *terminal,
+vte_sequence_handler_offset(VteBuffer *buffer,
GValueArray *params,
int increment,
VteSequenceHandler handler)
@@ -457,12 +448,12 @@ vte_sequence_handler_offset(VteTerminal *terminal,
g_value_set_long(value, val);
}
}
- handler (terminal, params);
+ handler (buffer, params);
}
/* Call another function a given number of times, or once. */
static void
-vte_sequence_handler_multiple(VteTerminal *terminal,
+vte_sequence_handler_multiple(VteBuffer *buffer,
GValueArray *params,
VteSequenceHandler handler)
{
@@ -478,13 +469,13 @@ vte_sequence_handler_multiple(VteTerminal *terminal,
}
}
for (i = 0; i < val; i++)
- handler (terminal, NULL);
+ handler (buffer, NULL);
}
/* Manipulate certain terminal attributes. */
static void
-vte_sequence_handler_decset_internal(VteTerminal *terminal,
+vte_sequence_handler_decset_internal(VteBuffer *buffer,
int setting,
gboolean restore,
gboolean save,
@@ -503,7 +494,7 @@ vte_sequence_handler_decset_internal(VteTerminal *terminal,
VteSequenceHandler reset, set;
} settings[] = {
/* 1: Application/normal cursor keys. */
- {1, NULL, &terminal->pvt->cursor_mode, NULL,
+ {1, NULL, &buffer->pvt->cursor_mode, NULL,
GINT_TO_POINTER(VTE_KEYMODE_NORMAL),
GINT_TO_POINTER(VTE_KEYMODE_APPLICATION),
NULL, NULL,},
@@ -512,30 +503,30 @@ vte_sequence_handler_decset_internal(VteTerminal *terminal,
/* 3: disallowed, window size is set by user. */
{3, NULL, NULL, NULL, NULL, NULL, NULL, NULL,},
/* 4: Smooth scroll. */
- {4, &terminal->pvt->smooth_scroll, NULL, NULL,
+ {4, &buffer->pvt->smooth_scroll, NULL, NULL,
GINT_TO_POINTER(FALSE),
GINT_TO_POINTER(TRUE),
NULL, NULL,},
/* 5: Reverse video. */
- {5, &terminal->pvt->screen->reverse_mode, NULL, NULL,
+ {5, &buffer->pvt->screen->reverse_mode, NULL, NULL,
GINT_TO_POINTER(FALSE),
GINT_TO_POINTER(TRUE),
NULL, NULL,},
/* 6: Origin mode: when enabled, cursor positioning is
* relative to the scrolling region. */
- {6, &terminal->pvt->screen->origin_mode, NULL, NULL,
+ {6, &buffer->pvt->screen->origin_mode, NULL, NULL,
GINT_TO_POINTER(FALSE),
GINT_TO_POINTER(TRUE),
NULL, NULL,},
/* 7: Wraparound mode. */
- {7, &terminal->pvt->flags.am, NULL, NULL,
+ {7, &buffer->pvt->flags.am, NULL, NULL,
GINT_TO_POINTER(FALSE),
GINT_TO_POINTER(TRUE),
NULL, NULL,},
/* 8: disallowed, keyboard repeat is set by user. */
{8, NULL, NULL, NULL, NULL, NULL, NULL, NULL,},
/* 9: Send-coords-on-click. */
- {9, NULL, &terminal->pvt->mouse_tracking_mode, NULL,
+ {9, NULL, &buffer->pvt->mouse_tracking_mode, NULL,
GINT_TO_POINTER(0),
GINT_TO_POINTER(MOUSE_TRACKING_SEND_XY_ON_CLICK),
NULL, NULL,},
@@ -544,7 +535,7 @@ vte_sequence_handler_decset_internal(VteTerminal *terminal,
/* 18: print form feed. */
/* 19: set print extent to full screen. */
/* 25: Cursor visible. */
- {25, &terminal->pvt->cursor_visible, NULL, NULL,
+ {25, &buffer->pvt->cursor_visible, NULL, NULL,
GINT_TO_POINTER(FALSE),
GINT_TO_POINTER(TRUE),
NULL, NULL,},
@@ -557,44 +548,44 @@ vte_sequence_handler_decset_internal(VteTerminal *terminal,
{40, NULL, NULL, NULL, NULL, NULL, NULL, NULL,},
/* 41: more(1) fix. */
/* 42: Enable NLS replacements. */
- {42, &terminal->pvt->nrc_mode, NULL, NULL,
+ {42, &buffer->pvt->nrc_mode, NULL, NULL,
GINT_TO_POINTER(FALSE),
GINT_TO_POINTER(TRUE),
NULL, NULL,},
/* 44: Margin bell. */
- {44, &terminal->pvt->margin_bell, NULL, NULL,
+ {44, &buffer->pvt->margin_bell, NULL, NULL,
GINT_TO_POINTER(FALSE),
GINT_TO_POINTER(TRUE),
NULL, NULL,},
/* 47: Alternate screen. */
- {47, NULL, NULL, (gpointer) &terminal->pvt->screen,
- &terminal->pvt->normal_screen,
- &terminal->pvt->alternate_screen,
+ {47, NULL, NULL, (gpointer) &buffer->pvt->screen,
+ &buffer->pvt->normal_screen,
+ &buffer->pvt->alternate_screen,
NULL, NULL,},
/* 66: Keypad mode. */
- {66, &terminal->pvt->keypad_mode, NULL, NULL,
+ {66, &buffer->pvt->keypad_mode, NULL, NULL,
GINT_TO_POINTER(VTE_KEYMODE_NORMAL),
GINT_TO_POINTER(VTE_KEYMODE_APPLICATION),
NULL, NULL,},
/* 67: disallowed, backspace key policy is set by user. */
{67, NULL, NULL, NULL, NULL, NULL, NULL, NULL,},
/* 1000: Send-coords-on-button. */
- {1000, NULL, &terminal->pvt->mouse_tracking_mode, NULL,
+ {1000, NULL, &buffer->pvt->mouse_tracking_mode, NULL,
GINT_TO_POINTER(0),
GINT_TO_POINTER(MOUSE_TRACKING_SEND_XY_ON_BUTTON),
NULL, NULL,},
/* 1001: Hilite tracking. */
- {1001, NULL, &terminal->pvt->mouse_tracking_mode, NULL,
+ {1001, NULL, &buffer->pvt->mouse_tracking_mode, NULL,
GINT_TO_POINTER(0),
GINT_TO_POINTER(MOUSE_TRACKING_HILITE_TRACKING),
NULL, NULL,},
/* 1002: Cell motion tracking. */
- {1002, NULL, &terminal->pvt->mouse_tracking_mode, NULL,
+ {1002, NULL, &buffer->pvt->mouse_tracking_mode, NULL,
GINT_TO_POINTER(0),
GINT_TO_POINTER(MOUSE_TRACKING_CELL_MOTION_TRACKING),
NULL, NULL,},
/* 1003: All motion tracking. */
- {1003, NULL, &terminal->pvt->mouse_tracking_mode, NULL,
+ {1003, NULL, &buffer->pvt->mouse_tracking_mode, NULL,
GINT_TO_POINTER(0),
GINT_TO_POINTER(MOUSE_TRACKING_ALL_MOTION_TRACKING),
NULL, NULL,},
@@ -605,16 +596,16 @@ vte_sequence_handler_decset_internal(VteTerminal *terminal,
/* 1035: disallowed, don't know what to do with it. */
{1035, NULL, NULL, NULL, NULL, NULL, NULL, NULL,},
/* 1036: Meta-sends-escape. */
- {1036, &terminal->pvt->meta_sends_escape, NULL, NULL,
+ {1036, &buffer->pvt->meta_sends_escape, NULL, NULL,
GINT_TO_POINTER(FALSE),
GINT_TO_POINTER(TRUE),
NULL, NULL,},
/* 1037: disallowed, delete key policy is set by user. */
{1037, NULL, NULL, NULL, NULL, NULL, NULL, NULL,},
/* 1047: Use alternate screen buffer. */
- {1047, NULL, NULL, (gpointer) &terminal->pvt->screen,
- &terminal->pvt->normal_screen,
- &terminal->pvt->alternate_screen,
+ {1047, NULL, NULL, (gpointer) &buffer->pvt->screen,
+ &buffer->pvt->normal_screen,
+ &buffer->pvt->alternate_screen,
NULL, NULL,},
/* 1048: Save/restore cursor position. */
{1048, NULL, NULL, NULL,
@@ -624,33 +615,33 @@ vte_sequence_handler_decset_internal(VteTerminal *terminal,
vte_sequence_handler_sc,},
/* 1049: Use alternate screen buffer, saving the cursor
* position. */
- {1049, NULL, NULL, (gpointer) &terminal->pvt->screen,
- &terminal->pvt->normal_screen,
- &terminal->pvt->alternate_screen,
+ {1049, NULL, NULL, (gpointer) &buffer->pvt->screen,
+ &buffer->pvt->normal_screen,
+ &buffer->pvt->alternate_screen,
vte_sequence_handler_rc,
vte_sequence_handler_sc,},
/* 1051: Sun function key mode. */
- {1051, NULL, NULL, (gpointer) &terminal->pvt->sun_fkey_mode,
+ {1051, NULL, NULL, (gpointer) &buffer->pvt->sun_fkey_mode,
GINT_TO_POINTER(FALSE),
GINT_TO_POINTER(TRUE),
NULL, NULL},
/* 1052: HP function key mode. */
- {1052, NULL, NULL, (gpointer) &terminal->pvt->hp_fkey_mode,
+ {1052, NULL, NULL, (gpointer) &buffer->pvt->hp_fkey_mode,
GINT_TO_POINTER(FALSE),
GINT_TO_POINTER(TRUE),
NULL, NULL},
/* 1060: Legacy function key mode. */
- {1060, NULL, NULL, (gpointer) &terminal->pvt->legacy_fkey_mode,
+ {1060, NULL, NULL, (gpointer) &buffer->pvt->legacy_fkey_mode,
GINT_TO_POINTER(FALSE),
GINT_TO_POINTER(TRUE),
NULL, NULL},
/* 1061: VT220 function key mode. */
- {1061, NULL, NULL, (gpointer) &terminal->pvt->vt220_fkey_mode,
+ {1061, NULL, NULL, (gpointer) &buffer->pvt->vt220_fkey_mode,
GINT_TO_POINTER(FALSE),
GINT_TO_POINTER(TRUE),
NULL, NULL},
/* 2004: Bracketed paste mode. */
- {2004, &terminal->pvt->screen->bracketed_paste_mode, NULL, NULL,
+ {2004, &buffer->pvt->screen->bracketed_paste_mode, NULL, NULL,
GINT_TO_POINTER(FALSE),
GINT_TO_POINTER(TRUE),
NULL, NULL,},
@@ -669,7 +660,7 @@ vte_sequence_handler_decset_internal(VteTerminal *terminal,
/* Read the old setting. */
if (restore) {
- p = g_hash_table_lookup(terminal->pvt->dec_saved,
+ p = g_hash_table_lookup(buffer->pvt->dec_saved,
GINT_TO_POINTER(setting));
set = (p != NULL);
_vte_debug_print(VTE_DEBUG_PARSE,
@@ -692,7 +683,7 @@ vte_sequence_handler_decset_internal(VteTerminal *terminal,
_vte_debug_print(VTE_DEBUG_PARSE,
"Setting %d is %s, saving.\n",
setting, set ? "set" : "unset");
- g_hash_table_insert(terminal->pvt->dec_saved,
+ g_hash_table_insert(buffer->pvt->dec_saved,
GINT_TO_POINTER(setting),
GINT_TO_POINTER(set));
}
@@ -702,7 +693,7 @@ vte_sequence_handler_decset_internal(VteTerminal *terminal,
"Setting %d to %s.\n",
setting, set ? "set" : "unset");
if (settings[i].set && set) {
- settings[i].set (terminal, NULL);
+ settings[i].set (buffer, NULL);
}
if (settings[i].bvalue) {
*(settings[i].bvalue) = set;
@@ -718,7 +709,7 @@ vte_sequence_handler_decset_internal(VteTerminal *terminal,
settings[i].fvalue;
}
if (settings[i].reset && !set) {
- settings[i].reset (terminal, NULL);
+ settings[i].reset (buffer, NULL);
}
}
}
@@ -732,28 +723,28 @@ vte_sequence_handler_decset_internal(VteTerminal *terminal,
break;
#if 0 /* 3: disallowed, window size is set by user. */
case 3:
- _vte_buffer_emit_resize_window(terminal->term_pvt->buffer,
+ _vte_buffer_emit_resize_window(buffer,
(set ? 132 : 80) *
- terminal->pvt->char_width +
- terminal->pvt->padding.left +
- terminal->pvt->padding.right,
- terminal->pvt->row_count *
- terminal->pvt->char_height +
- terminal->pvt->padding.top +
- terminal->pvt->padding.bottom);
+ buffer->pvt->char_width +
+ buffer->pvt->padding.left +
+ buffer->pvt->padding.right,
+ buffer->pvt->row_count *
+ buffer->pvt->char_height +
+ buffer->pvt->padding.top +
+ buffer->pvt->padding.bottom);
/* Request a resize and redraw. */
- _vte_invalidate_all(terminal);
+ _vte_invalidate_all(buffer->pvt->terminal);
break;
#endif
case 5:
/* Repaint everything in reverse mode. */
- _vte_invalidate_all(terminal);
+ _vte_invalidate_all(buffer->pvt->terminal);
break;
case 6:
/* Reposition the cursor in its new home position. */
- terminal->pvt->screen->cursor_current.col = 0;
- terminal->pvt->screen->cursor_current.row =
- terminal->pvt->screen->insert_delta;
+ buffer->pvt->screen->cursor_current.col = 0;
+ buffer->pvt->screen->cursor_current.row =
+ buffer->pvt->screen->insert_delta;
break;
case 47:
case 1047:
@@ -761,16 +752,16 @@ vte_sequence_handler_decset_internal(VteTerminal *terminal,
/* Clear the alternate screen if we're switching
* to it, and home the cursor. */
if (set) {
- _vte_buffer_clear_screen (terminal->term_pvt->buffer);
- _vte_buffer_home_cursor (terminal->term_pvt->buffer);
+ _vte_buffer_clear_screen (buffer);
+ _vte_buffer_home_cursor (buffer);
}
/* Reset scrollbars and repaint everything. */
- gtk_adjustment_set_value(terminal->pvt->vadjustment,
- terminal->pvt->screen->scroll_delta);
- vte_buffer_set_scrollback_lines(terminal->term_pvt->buffer,
- terminal->pvt->scrollback_lines);
- _vte_terminal_queue_contents_changed(terminal);
- _vte_invalidate_all (terminal);
+ gtk_adjustment_set_value(buffer->pvt->vadjustment,
+ buffer->pvt->screen->scroll_delta);
+ vte_buffer_set_scrollback_lines(buffer,
+ buffer->pvt->scrollback_lines);
+ _vte_terminal_queue_contents_changed(buffer->pvt->terminal);
+ _vte_invalidate_all (buffer->pvt->terminal);
break;
case 9:
case 1000:
@@ -778,7 +769,7 @@ vte_sequence_handler_decset_internal(VteTerminal *terminal,
case 1002:
case 1003:
/* Make the pointer visible. */
- _vte_terminal_set_pointer_visible(terminal, TRUE);
+ _vte_terminal_set_pointer_visible(buffer->pvt->terminal, TRUE);
break;
case 66:
_vte_debug_print(VTE_DEBUG_KEYBOARD, set ?
@@ -824,26 +815,26 @@ vte_sequence_handler_decset_internal(VteTerminal *terminal,
/* End alternate character set. */
static void
-vte_sequence_handler_ae (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_ae (VteBuffer *buffer, GValueArray *params)
{
- terminal->pvt->screen->alternate_charset = FALSE;
+ buffer->pvt->screen->alternate_charset = FALSE;
}
/* Add a line at the current cursor position. */
static void
-vte_sequence_handler_al (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_al (VteBuffer *buffer, 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;
+ screen = buffer->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;
+ end = screen->insert_delta + buffer->pvt->row_count - 1;
}
/* Extract any parameters. */
@@ -859,56 +850,56 @@ vte_sequence_handler_al (VteTerminal *terminal, GValueArray *params)
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_buffer_ring_remove (terminal->term_pvt->buffer, end);
- _vte_buffer_ring_insert (terminal->term_pvt->buffer, start, TRUE);
+ _vte_buffer_ring_remove (buffer, end);
+ _vte_buffer_ring_insert (buffer, start, TRUE);
/* Adjust the scrollbars if necessary. */
- _vte_terminal_adjust_adjustments(terminal);
+ _vte_terminal_adjust_adjustments(buffer->pvt->terminal);
}
/* Update the display. */
- _vte_terminal_scroll_region(terminal, start, end - start + 1, param);
+ _vte_terminal_scroll_region(buffer->pvt->terminal, start, end - start + 1, param);
/* We've modified the display. Make a note of it. */
- terminal->pvt->text_deleted_flag = TRUE;
+ buffer->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 (VteBuffer *buffer, GValueArray *params)
{
- vte_sequence_handler_al (terminal, params);
+ vte_sequence_handler_al (buffer, params);
}
/* Start using alternate character set. */
static void
-vte_sequence_handler_as (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_as (VteBuffer *buffer, GValueArray *params)
{
- terminal->pvt->screen->alternate_charset = TRUE;
+ buffer->pvt->screen->alternate_charset = TRUE;
}
/* Beep. */
static void
-vte_sequence_handler_bl (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_bl (VteBuffer *buffer, GValueArray *params)
{
- _vte_terminal_beep (terminal);
- g_signal_emit_by_name(terminal, "beep");
+ _vte_terminal_beep (buffer->pvt->terminal);
+ g_signal_emit_by_name(buffer->pvt->terminal, "beep");
}
/* Backtab. */
static void
-vte_sequence_handler_bt (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_bt (VteBuffer *buffer, GValueArray *params)
{
long newcol;
/* Calculate which column is the previous tab stop. */
- newcol = terminal->pvt->screen->cursor_current.col;
+ newcol = buffer->pvt->screen->cursor_current.col;
- if (terminal->pvt->tabstops != NULL) {
+ if (buffer->pvt->tabstops != NULL) {
/* Find the next tabstop. */
while (newcol > 0) {
newcol--;
- if (_vte_buffer_get_tabstop(terminal->term_pvt->buffer,
- newcol % terminal->pvt->column_count)) {
+ if (_vte_buffer_get_tabstop(buffer,
+ newcol % buffer->pvt->column_count)) {
break;
}
}
@@ -917,19 +908,18 @@ vte_sequence_handler_bt (VteTerminal *terminal, GValueArray *params)
/* Warp the cursor. */
_vte_debug_print(VTE_DEBUG_PARSE,
"Moving cursor to column %ld.\n", (long)newcol);
- terminal->pvt->screen->cursor_current.col = newcol;
+ buffer->pvt->screen->cursor_current.col = newcol;
}
/* Clear from the cursor position to the beginning of the line. */
static void
-vte_sequence_handler_cb (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_cb (VteBuffer *buffer, GValueArray *params)
{
- VteBuffer *buffer = terminal->term_pvt->buffer;
VteRowData *rowdata;
long i;
VteScreen *screen;
VteCell *pcell;
- screen = terminal->pvt->screen;
+ screen = buffer->pvt->screen;
/* Get the data for the row which the cursor points to. */
rowdata = _vte_buffer_ensure_row(buffer);
@@ -947,23 +937,23 @@ vte_sequence_handler_cb (VteTerminal *terminal, GValueArray *params)
}
}
/* Repaint this row. */
- _vte_invalidate_cells(terminal,
+ _vte_invalidate_cells(buffer->pvt->terminal,
0, screen->cursor_current.col+1,
screen->cursor_current.row, 1);
/* We've modified the display. Make a note of it. */
- terminal->pvt->text_deleted_flag = TRUE;
+ buffer->pvt->text_deleted_flag = TRUE;
}
/* Clear to the right of the cursor and below the current line. */
static void
-vte_sequence_handler_cd (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_cd (VteBuffer *buffer, GValueArray *params)
{
VteRowData *rowdata;
glong i;
VteScreen *screen;
- screen = terminal->pvt->screen;
+ screen = buffer->pvt->screen;
/* If the cursor is actually on the screen, clear the rest of the
* row the cursor is on and all of the rows below the cursor. */
i = screen->cursor_current.row;
@@ -986,37 +976,36 @@ vte_sequence_handler_cd (VteTerminal *terminal, GValueArray *params)
}
/* Now fill the cleared areas. */
for (i = screen->cursor_current.row;
- i < screen->insert_delta + terminal->pvt->row_count;
+ i < screen->insert_delta + buffer->pvt->row_count;
i++) {
/* Retrieve the row's data, creating it if necessary. */
if (_vte_ring_contains (screen->row_data, i)) {
rowdata = _vte_ring_index_writable (screen->row_data, i);
g_assert(rowdata != NULL);
} else {
- rowdata = _vte_buffer_ring_append (terminal->term_pvt->buffer, FALSE);
+ rowdata = _vte_buffer_ring_append (buffer, FALSE);
}
/* Pad out the row. */
- _vte_row_data_fill (rowdata, &screen->fill_defaults, terminal->pvt->column_count);
+ _vte_row_data_fill (rowdata, &screen->fill_defaults, buffer->pvt->column_count);
rowdata->attr.soft_wrapped = 0;
/* Repaint this row. */
- _vte_invalidate_cells(terminal,
- 0, terminal->pvt->column_count,
+ _vte_invalidate_cells(buffer->pvt->terminal,
+ 0, buffer->pvt->column_count,
i, 1);
}
/* We've modified the display. Make a note of it. */
- terminal->pvt->text_deleted_flag = TRUE;
+ buffer->pvt->text_deleted_flag = TRUE;
}
/* Clear from the cursor position to the end of the line. */
static void
-vte_sequence_handler_ce (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_ce (VteBuffer *buffer, GValueArray *params)
{
- VteBuffer *buffer = terminal->term_pvt->buffer;
VteRowData *rowdata;
VteScreen *screen;
- screen = terminal->pvt->screen;
+ screen = buffer->pvt->screen;
/* Get the data for the row which the cursor points to. */
rowdata = _vte_buffer_ensure_row(buffer);
g_assert(rowdata != NULL);
@@ -1025,38 +1014,37 @@ vte_sequence_handler_ce (VteTerminal *terminal, GValueArray *params)
if ((glong) _vte_row_data_length (rowdata) > screen->cursor_current.col) {
_vte_row_data_shrink (rowdata, screen->cursor_current.col);
/* We've modified the display. Make a note of it. */
- terminal->pvt->text_deleted_flag = TRUE;
+ buffer->pvt->text_deleted_flag = TRUE;
}
if (screen->fill_defaults.attr.back != VTE_DEF_BG) {
/* Add enough cells to fill out the row. */
- _vte_row_data_fill (rowdata, &screen->fill_defaults, terminal->pvt->column_count);
+ _vte_row_data_fill (rowdata, &screen->fill_defaults, buffer->pvt->column_count);
}
rowdata->attr.soft_wrapped = 0;
/* Repaint this row. */
- _vte_invalidate_cells(terminal,
+ _vte_invalidate_cells(buffer->pvt->terminal,
screen->cursor_current.col,
- terminal->pvt->column_count -
+ buffer->pvt->column_count -
screen->cursor_current.col,
screen->cursor_current.row, 1);
}
/* Move the cursor to the given column (horizontal position). */
static void
-vte_sequence_handler_ch (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_ch (VteBuffer *buffer, GValueArray *params)
{
- VteBuffer *buffer = terminal->term_pvt->buffer;
VteScreen *screen;
GValue *value;
long val;
- screen = terminal->pvt->screen;
+ screen = buffer->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);
if (G_VALUE_HOLDS_LONG(value)) {
val = CLAMP(g_value_get_long(value),
0,
- terminal->pvt->column_count - 1);
+ buffer->pvt->column_count - 1);
/* Move the cursor. */
screen->cursor_current.col = val;
_vte_buffer_cleanup_tab_fragments_at_cursor (buffer);
@@ -1066,25 +1054,24 @@ vte_sequence_handler_ch (VteTerminal *terminal, GValueArray *params)
/* Clear the screen and home the cursor. */
static void
-vte_sequence_handler_cl (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_cl (VteBuffer *buffer, GValueArray *params)
{
- _vte_buffer_clear_screen (terminal->term_pvt->buffer);
- _vte_buffer_home_cursor (terminal->term_pvt->buffer);
+ _vte_buffer_clear_screen (buffer);
+ _vte_buffer_home_cursor (buffer);
/* We've modified the display. Make a note of it. */
- terminal->pvt->text_deleted_flag = TRUE;
+ buffer->pvt->text_deleted_flag = TRUE;
}
/* Move the cursor to the given position. */
static void
-vte_sequence_handler_cm (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_cm (VteBuffer *buffer, GValueArray *params)
{
- VteBuffer *buffer = terminal->term_pvt->buffer;
GValue *row, *col;
long rowval, colval, origin;
VteScreen *screen;
- screen = terminal->pvt->screen;
+ screen = buffer->pvt->screen;
/* We need at least two parameters. */
rowval = colval = 0;
@@ -1099,13 +1086,13 @@ vte_sequence_handler_cm (VteTerminal *terminal, GValueArray *params)
origin = 0;
}
rowval = g_value_get_long(row) + origin;
- rowval = CLAMP(rowval, 0, terminal->pvt->row_count - 1);
+ rowval = CLAMP(rowval, 0, buffer->pvt->row_count - 1);
}
if (params->n_values >= 2) {
col = g_value_array_get_nth(params, 1);
if (G_VALUE_HOLDS_LONG(col)) {
colval = g_value_get_long(col);
- colval = CLAMP(colval, 0, terminal->pvt->column_count - 1);
+ colval = CLAMP(colval, 0, buffer->pvt->column_count - 1);
}
}
}
@@ -1116,23 +1103,23 @@ vte_sequence_handler_cm (VteTerminal *terminal, GValueArray *params)
/* Carriage return. */
static void
-vte_sequence_handler_cr (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_cr (VteBuffer *buffer, GValueArray *params)
{
- terminal->pvt->screen->cursor_current.col = 0;
+ buffer->pvt->screen->cursor_current.col = 0;
}
/* Restrict scrolling and updates to a subset of the visible lines. */
static void
-vte_sequence_handler_cs (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_cs (VteBuffer *buffer, GValueArray *params)
{
long start=-1, end=-1, rows;
GValue *value;
VteScreen *screen;
- _vte_buffer_home_cursor (terminal->term_pvt->buffer);
+ _vte_buffer_home_cursor (buffer);
/* We require two parameters. Anything less is a reset. */
- screen = terminal->pvt->screen;
+ screen = buffer->pvt->screen;
if ((params == NULL) || (params->n_values < 2)) {
screen->scrolling_restricted = FALSE;
return;
@@ -1147,7 +1134,7 @@ vte_sequence_handler_cs (VteTerminal *terminal, GValueArray *params)
end = g_value_get_long(value);
}
/* Catch garbage. */
- rows = terminal->pvt->row_count;
+ rows = buffer->pvt->row_count;
if (start <= 0 || start >= rows) {
start = 0;
}
@@ -1168,14 +1155,14 @@ vte_sequence_handler_cs (VteTerminal *terminal, GValueArray *params)
/* Restrict scrolling and updates to a subset of the visible lines, because
* GNU Emacs is special. */
static void
-vte_sequence_handler_cS (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_cS (VteBuffer *buffer, GValueArray *params)
{
- long start=0, end=terminal->pvt->row_count-1, rows;
+ long start=0, end=buffer->pvt->row_count-1, rows;
GValue *value;
VteScreen *screen;
/* We require four parameters. */
- screen = terminal->pvt->screen;
+ screen = buffer->pvt->screen;
if ((params == NULL) || (params->n_values < 2)) {
screen->scrolling_restricted = FALSE;
return;
@@ -1195,7 +1182,7 @@ vte_sequence_handler_cS (VteTerminal *terminal, GValueArray *params)
screen->scrolling_region.end = end;
screen->scrolling_restricted = TRUE;
/* Special case -- run wild, run free. */
- rows = terminal->pvt->row_count;
+ rows = buffer->pvt->row_count;
if ((screen->scrolling_region.start == 0) &&
(screen->scrolling_region.end == rows - 1)) {
screen->scrolling_restricted = FALSE;
@@ -1208,47 +1195,47 @@ vte_sequence_handler_cS (VteTerminal *terminal, GValueArray *params)
/* Clear all tab stops. */
static void
-vte_sequence_handler_ct (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_ct (VteBuffer *buffer, GValueArray *params)
{
- _vte_buffer_clear_tabstops(terminal->term_pvt->buffer);
+ _vte_buffer_clear_tabstops(buffer);
}
/* Move the cursor to the lower left-hand corner. */
static void
-vte_sequence_handler_cursor_lower_left (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_cursor_lower_left (VteBuffer *buffer, GValueArray *params)
{
VteScreen *screen;
long row;
- screen = terminal->pvt->screen;
- row = MAX(0, terminal->pvt->row_count - 1);
+ screen = buffer->pvt->screen;
+ row = MAX(0, buffer->pvt->row_count - 1);
screen->cursor_current.row = screen->insert_delta + row;
screen->cursor_current.col = 0;
}
/* Move the cursor to the beginning of the next line, scrolling if necessary. */
static void
-vte_sequence_handler_cursor_next_line (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_cursor_next_line (VteBuffer *buffer, GValueArray *params)
{
- terminal->pvt->screen->cursor_current.col = 0;
- vte_sequence_handler_DO (terminal, params);
+ buffer->pvt->screen->cursor_current.col = 0;
+ vte_sequence_handler_DO (buffer, params);
}
/* Move the cursor to the beginning of the next line, scrolling if necessary. */
static void
-vte_sequence_handler_cursor_preceding_line (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_cursor_preceding_line (VteBuffer *buffer, GValueArray *params)
{
- terminal->pvt->screen->cursor_current.col = 0;
- vte_sequence_handler_UP (terminal, params);
+ buffer->pvt->screen->cursor_current.col = 0;
+ vte_sequence_handler_UP (buffer, params);
}
/* Move the cursor to the given row (vertical position). */
static void
-vte_sequence_handler_cv (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_cv (VteBuffer *buffer, GValueArray *params)
{
VteScreen *screen;
GValue *value;
long val, origin;
- screen = terminal->pvt->screen;
+ screen = buffer->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);
@@ -1261,7 +1248,7 @@ vte_sequence_handler_cv (VteTerminal *terminal, GValueArray *params)
origin = 0;
}
val = g_value_get_long(value) + origin;
- val = CLAMP(val, 0, terminal->pvt->row_count - 1);
+ val = CLAMP(val, 0, buffer->pvt->row_count - 1);
screen->cursor_current.row = screen->insert_delta + val;
}
}
@@ -1269,13 +1256,13 @@ vte_sequence_handler_cv (VteTerminal *terminal, GValueArray *params)
/* Delete a character at the current cursor position. */
static void
-vte_sequence_handler_dc (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_dc (VteBuffer *buffer, GValueArray *params)
{
VteScreen *screen;
VteRowData *rowdata;
long col;
- screen = terminal->pvt->screen;
+ screen = buffer->pvt->screen;
if (_vte_ring_next(screen->row_data) > screen->cursor_current.row) {
long len;
@@ -1288,42 +1275,42 @@ vte_sequence_handler_dc (VteTerminal *terminal, GValueArray *params)
if (col < len) {
_vte_row_data_remove (rowdata, col);
if (screen->fill_defaults.attr.back != VTE_DEF_BG) {
- _vte_row_data_fill (rowdata, &screen->fill_defaults, terminal->pvt->column_count);
- len = terminal->pvt->column_count;
+ _vte_row_data_fill (rowdata, &screen->fill_defaults, buffer->pvt->column_count);
+ len = buffer->pvt->column_count;
}
/* Repaint this row. */
- _vte_invalidate_cells(terminal,
+ _vte_invalidate_cells(buffer->pvt->terminal,
col, len - col,
screen->cursor_current.row, 1);
}
}
/* We've modified the display. Make a note of it. */
- terminal->pvt->text_deleted_flag = TRUE;
+ buffer->pvt->text_deleted_flag = TRUE;
}
/* Delete N characters at the current cursor position. */
static void
-vte_sequence_handler_DC (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_DC (VteBuffer *buffer, GValueArray *params)
{
- vte_sequence_handler_multiple(terminal, params, vte_sequence_handler_dc);
+ vte_sequence_handler_multiple(buffer, params, vte_sequence_handler_dc);
}
/* Delete a line at the current cursor position. */
static void
-vte_sequence_handler_dl (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_dl (VteBuffer *buffer, 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;
+ screen = buffer->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;
+ end = screen->insert_delta + buffer->pvt->row_count - 1;
}
/* Extract any parameters. */
@@ -1339,41 +1326,41 @@ vte_sequence_handler_dl (VteTerminal *terminal, GValueArray *params)
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_buffer_ring_remove (terminal->term_pvt->buffer, start);
- _vte_buffer_ring_insert (terminal->term_pvt->buffer, end, TRUE);
+ _vte_buffer_ring_remove (buffer, start);
+ _vte_buffer_ring_insert (buffer, end, TRUE);
/* Adjust the scrollbars if necessary. */
- _vte_terminal_adjust_adjustments(terminal);
+ _vte_terminal_adjust_adjustments(buffer->pvt->terminal);
}
/* Update the display. */
- _vte_terminal_scroll_region(terminal, start, end - start + 1, -param);
+ _vte_terminal_scroll_region(buffer->pvt->terminal, start, end - start + 1, -param);
/* We've modified the display. Make a note of it. */
- terminal->pvt->text_deleted_flag = TRUE;
+ buffer->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_DL (VteBuffer *buffer, GValueArray *params)
{
- vte_sequence_handler_dl (terminal, params);
+ vte_sequence_handler_dl (buffer, params);
}
/* Cursor down, no scrolling. */
static void
-vte_sequence_handler_do (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_do (VteBuffer *buffer, GValueArray *params)
{
long start, end;
VteScreen *screen;
- screen = terminal->pvt->screen;
+ screen = buffer->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->pvt->row_count - 1;
+ end = start + buffer->pvt->row_count - 1;
}
/* Move the cursor down. */
@@ -1382,31 +1369,30 @@ vte_sequence_handler_do (VteTerminal *terminal, GValueArray *params)
/* Cursor down, no scrolling. */
static void
-vte_sequence_handler_DO (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_DO (VteBuffer *buffer, GValueArray *params)
{
- vte_sequence_handler_multiple(terminal, params, vte_sequence_handler_do);
+ vte_sequence_handler_multiple(buffer, params, vte_sequence_handler_do);
}
/* Start using alternate character set. */
static void
-vte_sequence_handler_eA (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_eA (VteBuffer *buffer, GValueArray *params)
{
- vte_sequence_handler_ae (terminal, params);
+ vte_sequence_handler_ae (buffer, 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_ec (VteBuffer *buffer, GValueArray *params)
{
- VteBuffer *buffer = terminal->term_pvt->buffer;
VteScreen *screen;
VteRowData *rowdata;
GValue *value;
VteCell *cell;
long col, i, count;
- screen = terminal->pvt->screen;
+ screen = buffer->pvt->screen;
/* If we got a parameter, use it. */
count = 1;
@@ -1438,128 +1424,127 @@ vte_sequence_handler_ec (VteTerminal *terminal, GValueArray *params)
}
}
/* Repaint this row. */
- _vte_invalidate_cells(terminal,
+ _vte_invalidate_cells(buffer->pvt->terminal,
screen->cursor_current.col, count,
screen->cursor_current.row, 1);
}
/* We've modified the display. Make a note of it. */
- terminal->pvt->text_deleted_flag = TRUE;
+ buffer->pvt->text_deleted_flag = TRUE;
}
/* End insert mode. */
static void
-vte_sequence_handler_ei (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_ei (VteBuffer *buffer, GValueArray *params)
{
- terminal->pvt->screen->insert_mode = FALSE;
+ buffer->pvt->screen->insert_mode = FALSE;
}
/* Form-feed / next-page. */
static void
-vte_sequence_handler_form_feed (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_form_feed (VteBuffer *buffer, GValueArray *params)
{
- vte_sequence_handler_index (terminal, params);
+ vte_sequence_handler_index (buffer, params);
}
/* Move from status line. */
static void
-vte_sequence_handler_fs (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_fs (VteBuffer *buffer, GValueArray *params)
{
- terminal->pvt->screen->status_line = FALSE;
+ buffer->pvt->screen->status_line = FALSE;
}
/* Move the cursor to the home position. */
static void
-vte_sequence_handler_ho (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_ho (VteBuffer *buffer, GValueArray *params)
{
- _vte_buffer_home_cursor (terminal->term_pvt->buffer);
+ _vte_buffer_home_cursor (buffer);
}
/* Move the cursor to a specified position. */
static void
-vte_sequence_handler_horizontal_and_vertical_position (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_horizontal_and_vertical_position (VteBuffer *buffer, GValueArray *params)
{
- vte_sequence_handler_offset(terminal, params, -1, vte_sequence_handler_cm);
+ vte_sequence_handler_offset(buffer, params, -1, vte_sequence_handler_cm);
}
/* Insert a character. */
static void
-vte_sequence_handler_ic (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_ic (VteBuffer *buffer, GValueArray *params)
{
VteVisualPosition save;
VteScreen *screen;
- screen = terminal->pvt->screen;
+ screen = buffer->pvt->screen;
save = screen->cursor_current;
- _vte_buffer_insert_char(terminal->term_pvt->buffer, ' ', TRUE, TRUE);
+ _vte_buffer_insert_char(buffer, ' ', TRUE, TRUE);
screen->cursor_current = save;
}
/* Insert N characters. */
static void
-vte_sequence_handler_IC (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_IC (VteBuffer *buffer, GValueArray *params)
{
- vte_sequence_handler_multiple(terminal, params, vte_sequence_handler_ic);
+ vte_sequence_handler_multiple(buffer, params, vte_sequence_handler_ic);
}
/* Begin insert mode. */
static void
-vte_sequence_handler_im (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_im (VteBuffer *buffer, GValueArray *params)
{
- terminal->pvt->screen->insert_mode = TRUE;
+ buffer->pvt->screen->insert_mode = TRUE;
}
/* Cursor down, with scrolling. */
static void
-vte_sequence_handler_index (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_index (VteBuffer *buffer, GValueArray *params)
{
- vte_sequence_handler_sf (terminal, params);
+ vte_sequence_handler_sf (buffer, params);
}
/* Send me a backspace key sym, will you? Guess that the application meant
* to send the cursor back one position. */
static void
-vte_sequence_handler_kb (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_kb (VteBuffer *buffer, GValueArray *params)
{
/* Move the cursor left. */
- vte_sequence_handler_le (terminal, params);
+ vte_sequence_handler_le (buffer, params);
}
/* Keypad mode end. */
static void
-vte_sequence_handler_ke (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_ke (VteBuffer *buffer, GValueArray *params)
{
- terminal->pvt->keypad_mode = VTE_KEYMODE_NORMAL;
+ buffer->pvt->keypad_mode = VTE_KEYMODE_NORMAL;
}
/* Keypad mode start. */
static void
-vte_sequence_handler_ks (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_ks (VteBuffer *buffer, GValueArray *params)
{
- terminal->pvt->keypad_mode = VTE_KEYMODE_APPLICATION;
+ buffer->pvt->keypad_mode = VTE_KEYMODE_APPLICATION;
}
/* Cursor left. */
static void
-vte_sequence_handler_le (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_le (VteBuffer *buffer, GValueArray *params)
{
- VteBuffer *buffer = terminal->term_pvt->buffer;
VteScreen *screen;
- screen = terminal->pvt->screen;
+ screen = buffer->pvt->screen;
if (screen->cursor_current.col > 0) {
/* There's room to move left, so do so. */
screen->cursor_current.col--;
_vte_buffer_cleanup_tab_fragments_at_cursor (buffer);
} else {
- if (terminal->pvt->flags.bw) {
+ if (buffer->pvt->flags.bw) {
/* Wrap to the previous line. */
- screen->cursor_current.col = terminal->pvt->column_count - 1;
+ screen->cursor_current.col = buffer->pvt->column_count - 1;
if (screen->scrolling_restricted) {
- vte_sequence_handler_sr (terminal, params);
+ vte_sequence_handler_sr (buffer, params);
} else {
screen->cursor_current.row = MAX(screen->cursor_current.row - 1,
screen->insert_delta);
@@ -1573,83 +1558,83 @@ vte_sequence_handler_le (VteTerminal *terminal, GValueArray *params)
/* Move the cursor left N columns. */
static void
-vte_sequence_handler_LE (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_LE (VteBuffer *buffer, GValueArray *params)
{
- vte_sequence_handler_multiple(terminal, params, vte_sequence_handler_le);
+ vte_sequence_handler_multiple(buffer, params, vte_sequence_handler_le);
}
/* Move the cursor to the lower left corner of the display. */
static void
-vte_sequence_handler_ll (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_ll (VteBuffer *buffer, GValueArray *params)
{
VteScreen *screen;
- screen = terminal->pvt->screen;
+ screen = buffer->pvt->screen;
screen->cursor_current.row = MAX(screen->insert_delta,
screen->insert_delta +
- terminal->pvt->row_count - 1);
+ buffer->pvt->row_count - 1);
screen->cursor_current.col = 0;
}
/* Blink on. */
static void
-vte_sequence_handler_mb (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_mb (VteBuffer *buffer, GValueArray *params)
{
- terminal->pvt->screen->defaults.attr.blink = 1;
+ buffer->pvt->screen->defaults.attr.blink = 1;
}
/* Bold on. */
static void
-vte_sequence_handler_md (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_md (VteBuffer *buffer, GValueArray *params)
{
- terminal->pvt->screen->defaults.attr.bold = 1;
- terminal->pvt->screen->defaults.attr.half = 0;
+ buffer->pvt->screen->defaults.attr.bold = 1;
+ buffer->pvt->screen->defaults.attr.half = 0;
}
/* End modes. */
static void
-vte_sequence_handler_me (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_me (VteBuffer *buffer, GValueArray *params)
{
- _vte_screen_set_default_attributes(terminal->pvt->screen);
+ _vte_screen_set_default_attributes(buffer->pvt->screen);
}
/* Half-bright on. */
static void
-vte_sequence_handler_mh (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_mh (VteBuffer *buffer, GValueArray *params)
{
- terminal->pvt->screen->defaults.attr.half = 1;
- terminal->pvt->screen->defaults.attr.bold = 0;
+ buffer->pvt->screen->defaults.attr.half = 1;
+ buffer->pvt->screen->defaults.attr.bold = 0;
}
/* Invisible on. */
static void
-vte_sequence_handler_mk (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_mk (VteBuffer *buffer, GValueArray *params)
{
- terminal->pvt->screen->defaults.attr.invisible = 1;
+ buffer->pvt->screen->defaults.attr.invisible = 1;
}
/* Protect on. */
static void
-vte_sequence_handler_mp (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_mp (VteBuffer *buffer, GValueArray *params)
{
/* unused; bug 499893
- terminal->pvt->screen->defaults.attr.protect = 1;
+ buffer->pvt->screen->defaults.attr.protect = 1;
*/
}
/* Reverse on. */
static void
-vte_sequence_handler_mr (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_mr (VteBuffer *buffer, GValueArray *params)
{
- terminal->pvt->screen->defaults.attr.reverse = 1;
+ buffer->pvt->screen->defaults.attr.reverse = 1;
}
/* Cursor right. */
static void
-vte_sequence_handler_nd (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_nd (VteBuffer *buffer, GValueArray *params)
{
VteScreen *screen;
- screen = terminal->pvt->screen;
- if ((screen->cursor_current.col + 1) < terminal->pvt->column_count) {
+ screen = buffer->pvt->screen;
+ if ((screen->cursor_current.col + 1) < buffer->pvt->column_count) {
/* There's room to move right. */
screen->cursor_current.col++;
}
@@ -1657,68 +1642,68 @@ vte_sequence_handler_nd (VteTerminal *terminal, GValueArray *params)
/* Move the cursor to the beginning of the next line, scrolling if necessary. */
static void
-vte_sequence_handler_next_line (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_next_line (VteBuffer *buffer, GValueArray *params)
{
- terminal->pvt->screen->cursor_current.col = 0;
- vte_sequence_handler_DO (terminal, params);
+ buffer->pvt->screen->cursor_current.col = 0;
+ vte_sequence_handler_DO (buffer, params);
}
/* No-op. */
static void
-vte_sequence_handler_noop (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_noop (VteBuffer *buffer, GValueArray *params)
{
}
/* Carriage return command(?). */
static void
-vte_sequence_handler_nw (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_nw (VteBuffer *buffer, GValueArray *params)
{
- vte_sequence_handler_cr (terminal, params);
+ vte_sequence_handler_cr (buffer, params);
}
/* Restore cursor (position). */
static void
-vte_sequence_handler_rc (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_rc (VteBuffer *buffer, GValueArray *params)
{
VteScreen *screen;
- screen = terminal->pvt->screen;
+ screen = buffer->pvt->screen;
screen->cursor_current.col = screen->cursor_saved.col;
screen->cursor_current.row = CLAMP(screen->cursor_saved.row +
screen->insert_delta,
screen->insert_delta,
screen->insert_delta +
- terminal->pvt->row_count - 1);
+ buffer->pvt->row_count - 1);
}
/* Cursor down, with scrolling. */
static void
-vte_sequence_handler_reverse_index (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_reverse_index (VteBuffer *buffer, GValueArray *params)
{
- vte_sequence_handler_sr (terminal, params);
+ vte_sequence_handler_sr (buffer, params);
}
/* Cursor right N characters. */
static void
-vte_sequence_handler_RI (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_RI (VteBuffer *buffer, GValueArray *params)
{
- vte_sequence_handler_multiple(terminal, params, vte_sequence_handler_nd);
+ vte_sequence_handler_multiple(buffer, params, vte_sequence_handler_nd);
}
/* Save cursor (position). */
static void
-vte_sequence_handler_sc (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_sc (VteBuffer *buffer, GValueArray *params)
{
VteScreen *screen;
- screen = terminal->pvt->screen;
+ screen = buffer->pvt->screen;
screen->cursor_saved.col = screen->cursor_current.col;
screen->cursor_saved.row = CLAMP(screen->cursor_current.row -
screen->insert_delta,
- 0, terminal->pvt->row_count - 1);
+ 0, buffer->pvt->row_count - 1);
}
/* Scroll the text down, but don't move the cursor. */
static void
-vte_sequence_handler_scroll_down (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_scroll_down (VteBuffer *buffer, GValueArray *params)
{
long val = 1;
GValue *value;
@@ -1731,12 +1716,12 @@ vte_sequence_handler_scroll_down (VteTerminal *terminal, GValueArray *params)
}
}
- _vte_buffer_scroll_text (terminal->term_pvt->buffer, val);
+ _vte_buffer_scroll_text (buffer, val);
}
/* change color in the palette */
static void
-vte_sequence_handler_change_color (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_change_color (VteBuffer *buffer, GValueArray *params)
{
gchar **pairs, *str = NULL;
GValue *value;
@@ -1749,7 +1734,7 @@ vte_sequence_handler_change_color (VteTerminal *terminal, GValueArray *params)
if (G_VALUE_HOLDS_STRING (value))
str = g_value_dup_string (value);
else if (G_VALUE_HOLDS_POINTER (value))
- str = vte_buffer_ucs4_to_utf8(terminal->term_pvt->buffer, g_value_get_pointer (value));
+ str = vte_buffer_ucs4_to_utf8(buffer, g_value_get_pointer (value));
if (! str)
return;
@@ -1767,16 +1752,16 @@ vte_sequence_handler_change_color (VteTerminal *terminal, GValueArray *params)
continue;
if (vte_parse_color (pairs[i + 1], &color)) {
- terminal->pvt->palette[idx] = color;
- VTE_PALETTE_SET_OVERRIDE(terminal->pvt->palette_set, idx);
+ buffer->pvt->palette[idx] = color;
+ VTE_PALETTE_SET_OVERRIDE(buffer->pvt->palette_set, idx);
} else if (strcmp (pairs[i + 1], "?") == 0) {
gchar buf[128];
g_snprintf (buf, sizeof (buf),
_VTE_CAP_OSC "4;%u;rgb:%04x/%04x/%04x" BEL, idx,
- (guint) (terminal->pvt->palette[idx].red * 65535.),
- (guint) (terminal->pvt->palette[idx].green * 65535.),
- (guint) (terminal->pvt->palette[idx].blue * 65535.));
- vte_terminal_feed_child (terminal, buf, -1);
+ (guint) (buffer->pvt->palette[idx].red * 65535.),
+ (guint) (buffer->pvt->palette[idx].green * 65535.),
+ (guint) (buffer->pvt->palette[idx].blue * 65535.));
+ vte_buffer_feed_child (buffer, buf, -1);
}
}
@@ -1785,13 +1770,13 @@ vte_sequence_handler_change_color (VteTerminal *terminal, GValueArray *params)
/* emit the refresh as the palette has changed and previous
* renders need to be updated. */
- _vte_buffer_emit_refresh_window (terminal->term_pvt->buffer);
+ _vte_buffer_emit_refresh_window (buffer);
}
}
/* Scroll the text up, but don't move the cursor. */
static void
-vte_sequence_handler_scroll_up (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_scroll_up (VteBuffer *buffer, GValueArray *params)
{
long val = 1;
GValue *value;
@@ -1804,14 +1789,13 @@ vte_sequence_handler_scroll_up (VteTerminal *terminal, GValueArray *params)
}
}
- _vte_buffer_scroll_text (terminal->term_pvt->buffer, -val);
+ _vte_buffer_scroll_text (buffer, -val);
}
/* Standout end. */
static void
-vte_sequence_handler_se (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_se (VteBuffer *buffer, GValueArray *params)
{
- VteBuffer *buffer = terminal->term_pvt->buffer;
char *standout;
/* Standout may be mapped to another attribute, so attempt to do
@@ -1831,7 +1815,7 @@ vte_sequence_handler_se (VteTerminal *terminal, GValueArray *params)
vte_buffer_termcap_string_same_as_for (buffer, standout, "mr") /* reverse */ ||
vte_buffer_termcap_string_same_as_for (buffer, standout, "us") /* underline */)
{
- vte_sequence_handler_me (terminal, params);
+ vte_sequence_handler_me (buffer, params);
} else {
/* Otherwise just set standout mode. */
buffer->pvt->screen->defaults.attr.standout = 0;
@@ -1842,24 +1826,23 @@ vte_sequence_handler_se (VteTerminal *terminal, GValueArray *params)
/* Cursor down, with scrolling. */
static void
-vte_sequence_handler_sf (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_sf (VteBuffer *buffer, GValueArray *params)
{
- _vte_buffer_cursor_down (terminal->term_pvt->buffer);
+ _vte_buffer_cursor_down (buffer);
}
/* Cursor down, with scrolling. */
static void
-vte_sequence_handler_SF (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_SF (VteBuffer *buffer, GValueArray *params)
{
/* XXX implement this directly in _vte_terminal_cursor_down */
- vte_sequence_handler_multiple(terminal, params, vte_sequence_handler_sf);
+ vte_sequence_handler_multiple(buffer, params, vte_sequence_handler_sf);
}
/* Standout start. */
static void
-vte_sequence_handler_so (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_so (VteBuffer *buffer, GValueArray *params)
{
- VteBuffer *buffer = terminal->term_pvt->buffer;
char *standout;
/* Standout may be mapped to another attribute, so attempt to do
@@ -1874,15 +1857,15 @@ vte_sequence_handler_so (VteTerminal *terminal, GValueArray *params)
g_assert(standout != NULL);
if (vte_buffer_termcap_string_same_as_for (buffer, standout, "mb") /* blink */)
- vte_sequence_handler_mb (terminal, params);
+ vte_sequence_handler_mb (buffer, params);
else if (vte_buffer_termcap_string_same_as_for (buffer, standout, "md") /* bold */)
- vte_sequence_handler_md (terminal, params);
+ vte_sequence_handler_md (buffer, params);
else if (vte_buffer_termcap_string_same_as_for (buffer, standout, "mh") /* half */)
- vte_sequence_handler_mh (terminal, params);
+ vte_sequence_handler_mh (buffer, params);
else if (vte_buffer_termcap_string_same_as_for (buffer, standout, "mr") /* reverse */)
- vte_sequence_handler_mr (terminal, params);
+ vte_sequence_handler_mr (buffer, params);
else if (vte_buffer_termcap_string_same_as_for (buffer, standout, "us") /* underline */)
- vte_sequence_handler_us (terminal, params);
+ vte_sequence_handler_us (buffer, params);
else {
/* Otherwise just set standout mode. */
buffer->pvt->screen->defaults.attr.standout = 1;
@@ -1893,54 +1876,52 @@ vte_sequence_handler_so (VteTerminal *terminal, GValueArray *params)
/* Cursor up, scrolling if need be. */
static void
-vte_sequence_handler_sr (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_sr (VteBuffer *buffer, GValueArray *params)
{
long start, end;
VteScreen *screen;
- screen = terminal->pvt->screen;
+ screen = buffer->pvt->screen;
if (screen->scrolling_restricted) {
start = screen->scrolling_region.start + screen->insert_delta;
end = screen->scrolling_region.end + screen->insert_delta;
} else {
- start = terminal->pvt->screen->insert_delta;
- end = start + terminal->pvt->row_count - 1;
+ start = buffer->pvt->screen->insert_delta;
+ end = start + buffer->pvt->row_count - 1;
}
if (screen->cursor_current.row == start) {
/* If we're at the top of the scrolling region, add a
* line at the top to scroll the bottom off. */
- _vte_buffer_ring_remove (terminal->term_pvt->buffer, end);
- _vte_buffer_ring_insert (terminal->term_pvt->buffer, start, TRUE);
+ _vte_buffer_ring_remove (buffer, end);
+ _vte_buffer_ring_insert (buffer, start, TRUE);
/* Update the display. */
- _vte_terminal_scroll_region(terminal, start, end - start + 1, 1);
- _vte_invalidate_cells(terminal,
- 0, terminal->pvt->column_count,
+ _vte_terminal_scroll_region(buffer->pvt->terminal, start, end - start + 1, 1);
+ _vte_invalidate_cells(buffer->pvt->terminal,
+ 0, buffer->pvt->column_count,
start, 2);
} else {
/* Otherwise, just move the cursor up. */
screen->cursor_current.row--;
}
/* Adjust the scrollbars if necessary. */
- _vte_terminal_adjust_adjustments(terminal);
+ _vte_terminal_adjust_adjustments(buffer->pvt->terminal);
/* We modified the display, so make a note of it. */
- terminal->pvt->text_modified_flag = TRUE;
+ buffer->pvt->text_modified_flag = TRUE;
}
/* Cursor up, with scrolling. */
static void
-vte_sequence_handler_SR (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_SR (VteBuffer *buffer, GValueArray *params)
{
- vte_sequence_handler_multiple(terminal, params, vte_sequence_handler_sr);
+ vte_sequence_handler_multiple(buffer, params, vte_sequence_handler_sr);
}
/* Set tab stop in the current column. */
static void
-vte_sequence_handler_st (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_st (VteBuffer *buffer, GValueArray *params)
{
- VteBuffer *buffer = terminal->term_pvt->buffer;
-
if (buffer->pvt->tabstops == NULL) {
buffer->pvt->tabstops = g_hash_table_new(NULL, NULL);
}
@@ -1950,14 +1931,13 @@ vte_sequence_handler_st (VteTerminal *terminal, GValueArray *params)
/* Tab. */
static void
-vte_sequence_handler_ta (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_ta (VteBuffer *buffer, GValueArray *params)
{
- VteBuffer *buffer = terminal->term_pvt->buffer;
VteScreen *screen;
long old_len, newcol, col;
/* Calculate which column is the next tab stop. */
- screen = terminal->pvt->screen;
+ screen = buffer->pvt->screen;
newcol = col = screen->cursor_current.col;
g_assert (col >= 0);
@@ -1973,8 +1953,8 @@ vte_sequence_handler_ta (VteTerminal *terminal, GValueArray *params)
/* If we have no tab stops or went past the end of the line, stop
* at the right-most column. */
- if (newcol >= terminal->pvt->column_count) {
- newcol = terminal->pvt->column_count - 1;
+ if (newcol >= buffer->pvt->column_count) {
+ newcol = buffer->pvt->column_count - 1;
}
/* but make sure we don't move cursor back (bug #340631) */
@@ -2032,7 +2012,7 @@ vte_sequence_handler_ta (VteTerminal *terminal, GValueArray *params)
}
}
- _vte_invalidate_cells (terminal,
+ _vte_invalidate_cells (buffer->pvt->terminal,
screen->cursor_current.col,
newcol - screen->cursor_current.col,
screen->cursor_current.row, 1);
@@ -2042,9 +2022,8 @@ vte_sequence_handler_ta (VteTerminal *terminal, GValueArray *params)
/* Clear tabs selectively. */
static void
-vte_sequence_handler_tab_clear (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_tab_clear (VteBuffer *buffer, GValueArray *params)
{
- VteBuffer *buffer = terminal->term_pvt->buffer;
GValue *value;
long param = 0;
@@ -2065,66 +2044,66 @@ vte_sequence_handler_tab_clear (VteTerminal *terminal, GValueArray *params)
/* Move to status line. */
static void
-vte_sequence_handler_ts (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_ts (VteBuffer *buffer, GValueArray *params)
{
- terminal->pvt->screen->status_line = TRUE;
- terminal->pvt->screen->status_line_changed = TRUE;
- g_string_truncate(terminal->pvt->screen->status_line_contents, 0);
+ buffer->pvt->screen->status_line = TRUE;
+ buffer->pvt->screen->status_line_changed = TRUE;
+ g_string_truncate(buffer->pvt->screen->status_line_contents, 0);
}
/* Underline this character and move right. */
static void
-vte_sequence_handler_uc (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_uc (VteBuffer *buffer, GValueArray *params)
{
VteCell *cell;
int column;
VteScreen *screen;
- screen = terminal->pvt->screen;
+ screen = buffer->pvt->screen;
column = screen->cursor_current.col;
- cell = vte_buffer_find_charcell_writable(terminal->term_pvt->buffer, column, screen->cursor_current.row);
+ cell = vte_buffer_find_charcell_writable(buffer, column, screen->cursor_current.row);
while ((cell != NULL) && (cell->attr.fragment) && (column > 0)) {
column--;
- cell = vte_buffer_find_charcell_writable(terminal->term_pvt->buffer, column, screen->cursor_current.row);
+ cell = vte_buffer_find_charcell_writable(buffer, column, screen->cursor_current.row);
}
if (cell != NULL) {
/* Set this character to be underlined. */
cell->attr.underline = 1;
/* Cause the character to be repainted. */
- _vte_invalidate_cells(terminal,
+ _vte_invalidate_cells(buffer->pvt->terminal,
column, cell->attr.columns,
screen->cursor_current.row, 1);
/* Move the cursor right. */
- vte_sequence_handler_nd (terminal, params);
+ vte_sequence_handler_nd (buffer, params);
}
/* We've modified the display without changing the text. Make a note
* of it. */
- terminal->pvt->text_modified_flag = TRUE;
+ buffer->pvt->text_modified_flag = TRUE;
}
/* Underline end. */
static void
-vte_sequence_handler_ue (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_ue (VteBuffer *buffer, GValueArray *params)
{
- terminal->pvt->screen->defaults.attr.underline = 0;
+ buffer->pvt->screen->defaults.attr.underline = 0;
}
/* Cursor up, no scrolling. */
static void
-vte_sequence_handler_up (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_up (VteBuffer *buffer, GValueArray *params)
{
VteScreen *screen;
long start, end;
- screen = terminal->pvt->screen;
+ screen = buffer->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->pvt->row_count - 1;
+ end = start + buffer->pvt->row_count - 1;
}
screen->cursor_current.row = MAX(screen->cursor_current.row - 1, start);
@@ -2132,57 +2111,57 @@ vte_sequence_handler_up (VteTerminal *terminal, GValueArray *params)
/* Cursor up N lines, no scrolling. */
static void
-vte_sequence_handler_UP (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_UP (VteBuffer *buffer, GValueArray *params)
{
- vte_sequence_handler_multiple(terminal, params, vte_sequence_handler_up);
+ vte_sequence_handler_multiple(buffer, params, vte_sequence_handler_up);
}
/* Underline start. */
static void
-vte_sequence_handler_us (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_us (VteBuffer *buffer, GValueArray *params)
{
- terminal->pvt->screen->defaults.attr.underline = 1;
+ buffer->pvt->screen->defaults.attr.underline = 1;
}
/* Visible bell. */
static void
-vte_sequence_handler_vb (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_vb (VteBuffer *buffer, GValueArray *params)
{
- _vte_terminal_visible_beep (terminal);
+ _vte_terminal_visible_beep (buffer->pvt->terminal);
}
/* Cursor visible. */
static void
-vte_sequence_handler_ve (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_ve (VteBuffer *buffer, GValueArray *params)
{
- terminal->pvt->cursor_visible = TRUE;
+ buffer->pvt->cursor_visible = TRUE;
}
/* Vertical tab. */
static void
-vte_sequence_handler_vertical_tab (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_vertical_tab (VteBuffer *buffer, GValueArray *params)
{
- vte_sequence_handler_index (terminal, params);
+ vte_sequence_handler_index (buffer, params);
}
/* Cursor invisible. */
static void
-vte_sequence_handler_vi (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_vi (VteBuffer *buffer, GValueArray *params)
{
- terminal->pvt->cursor_visible = FALSE;
+ buffer->pvt->cursor_visible = FALSE;
}
/* Cursor standout. */
static void
-vte_sequence_handler_vs (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_vs (VteBuffer *buffer, GValueArray *params)
{
- terminal->pvt->cursor_visible = TRUE; /* FIXME: should be *more*
+ buffer->pvt->cursor_visible = TRUE; /* FIXME: should be *more*
visible. */
}
/* Handle ANSI color setting and related stuffs (SGR). */
static void
-vte_sequence_handler_character_attributes (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_character_attributes (VteBuffer *buffer, GValueArray *params)
{
unsigned int i;
GValue *value;
@@ -2199,50 +2178,50 @@ vte_sequence_handler_character_attributes (VteTerminal *terminal, GValueArray *p
param = g_value_get_long(value);
switch (param) {
case 0:
- _vte_screen_set_default_attributes(terminal->pvt->screen);
+ _vte_screen_set_default_attributes(buffer->pvt->screen);
break;
case 1:
- terminal->pvt->screen->defaults.attr.bold = 1;
- terminal->pvt->screen->defaults.attr.half = 0;
+ buffer->pvt->screen->defaults.attr.bold = 1;
+ buffer->pvt->screen->defaults.attr.half = 0;
break;
case 2:
- terminal->pvt->screen->defaults.attr.half = 1;
- terminal->pvt->screen->defaults.attr.bold = 0;
+ buffer->pvt->screen->defaults.attr.half = 1;
+ buffer->pvt->screen->defaults.attr.bold = 0;
break;
case 4:
- terminal->pvt->screen->defaults.attr.underline = 1;
+ buffer->pvt->screen->defaults.attr.underline = 1;
break;
case 5:
- terminal->pvt->screen->defaults.attr.blink = 1;
+ buffer->pvt->screen->defaults.attr.blink = 1;
break;
case 7:
- terminal->pvt->screen->defaults.attr.reverse = 1;
+ buffer->pvt->screen->defaults.attr.reverse = 1;
break;
case 8:
- terminal->pvt->screen->defaults.attr.invisible = 1;
+ buffer->pvt->screen->defaults.attr.invisible = 1;
break;
case 9:
- terminal->pvt->screen->defaults.attr.strikethrough = 1;
+ buffer->pvt->screen->defaults.attr.strikethrough = 1;
break;
case 21: /* Error in old versions of linux console. */
case 22: /* ECMA 48. */
- terminal->pvt->screen->defaults.attr.bold = 0;
- terminal->pvt->screen->defaults.attr.half = 0;
+ buffer->pvt->screen->defaults.attr.bold = 0;
+ buffer->pvt->screen->defaults.attr.half = 0;
break;
case 24:
- terminal->pvt->screen->defaults.attr.underline = 0;
+ buffer->pvt->screen->defaults.attr.underline = 0;
break;
case 25:
- terminal->pvt->screen->defaults.attr.blink = 0;
+ buffer->pvt->screen->defaults.attr.blink = 0;
break;
case 27:
- terminal->pvt->screen->defaults.attr.reverse = 0;
+ buffer->pvt->screen->defaults.attr.reverse = 0;
break;
case 28:
- terminal->pvt->screen->defaults.attr.invisible = 0;
+ buffer->pvt->screen->defaults.attr.invisible = 0;
break;
case 29:
- terminal->pvt->screen->defaults.attr.strikethrough = 0;
+ buffer->pvt->screen->defaults.attr.strikethrough = 0;
break;
case 30:
case 31:
@@ -2252,7 +2231,7 @@ vte_sequence_handler_character_attributes (VteTerminal *terminal, GValueArray *p
case 35:
case 36:
case 37:
- terminal->pvt->screen->defaults.attr.fore = param - 30;
+ buffer->pvt->screen->defaults.attr.fore = param - 30;
break;
case 38:
{
@@ -2268,14 +2247,14 @@ vte_sequence_handler_character_attributes (VteTerminal *terminal, GValueArray *p
param1 = g_value_get_long(value1);
param2 = g_value_get_long(value2);
if (G_LIKELY (param1 == 5 && param2 >= 0 && param2 < 256))
- terminal->pvt->screen->defaults.attr.fore = param2;
+ buffer->pvt->screen->defaults.attr.fore = param2;
i += 2;
}
break;
}
case 39:
/* default foreground */
- terminal->pvt->screen->defaults.attr.fore = VTE_DEF_FG;
+ buffer->pvt->screen->defaults.attr.fore = VTE_DEF_FG;
break;
case 40:
case 41:
@@ -2285,7 +2264,7 @@ vte_sequence_handler_character_attributes (VteTerminal *terminal, GValueArray *p
case 45:
case 46:
case 47:
- terminal->pvt->screen->defaults.attr.back = param - 40;
+ buffer->pvt->screen->defaults.attr.back = param - 40;
break;
case 48:
{
@@ -2301,14 +2280,14 @@ vte_sequence_handler_character_attributes (VteTerminal *terminal, GValueArray *p
param1 = g_value_get_long(value1);
param2 = g_value_get_long(value2);
if (G_LIKELY (param1 == 5 && param2 >= 0 && param2 < 256))
- terminal->pvt->screen->defaults.attr.back = param2;
+ buffer->pvt->screen->defaults.attr.back = param2;
i += 2;
}
break;
}
case 49:
/* default background */
- terminal->pvt->screen->defaults.attr.back = VTE_DEF_BG;
+ buffer->pvt->screen->defaults.attr.back = VTE_DEF_BG;
break;
case 90:
case 91:
@@ -2318,7 +2297,7 @@ vte_sequence_handler_character_attributes (VteTerminal *terminal, GValueArray *p
case 95:
case 96:
case 97:
- terminal->pvt->screen->defaults.attr.fore = param - 90 + VTE_COLOR_BRIGHT_OFFSET;
+ buffer->pvt->screen->defaults.attr.fore = param - 90 + VTE_COLOR_BRIGHT_OFFSET;
break;
case 100:
case 101:
@@ -2328,42 +2307,41 @@ vte_sequence_handler_character_attributes (VteTerminal *terminal, GValueArray *p
case 105:
case 106:
case 107:
- terminal->pvt->screen->defaults.attr.back = param - 100 + VTE_COLOR_BRIGHT_OFFSET;
+ buffer->pvt->screen->defaults.attr.back = param - 100 + VTE_COLOR_BRIGHT_OFFSET;
break;
}
}
/* If we had no parameters, default to the defaults. */
if (i == 0) {
- _vte_screen_set_default_attributes(terminal->pvt->screen);
+ _vte_screen_set_default_attributes(buffer->pvt->screen);
}
/* Save the new colors. */
- terminal->pvt->screen->color_defaults.attr.fore =
- terminal->pvt->screen->defaults.attr.fore;
- terminal->pvt->screen->color_defaults.attr.back =
- terminal->pvt->screen->defaults.attr.back;
- terminal->pvt->screen->fill_defaults.attr.fore =
- terminal->pvt->screen->defaults.attr.fore;
- terminal->pvt->screen->fill_defaults.attr.back =
- terminal->pvt->screen->defaults.attr.back;
+ buffer->pvt->screen->color_defaults.attr.fore =
+ buffer->pvt->screen->defaults.attr.fore;
+ buffer->pvt->screen->color_defaults.attr.back =
+ buffer->pvt->screen->defaults.attr.back;
+ buffer->pvt->screen->fill_defaults.attr.fore =
+ buffer->pvt->screen->defaults.attr.fore;
+ buffer->pvt->screen->fill_defaults.attr.back =
+ buffer->pvt->screen->defaults.attr.back;
}
/* Move the cursor to the given column, 1-based. */
static void
-vte_sequence_handler_cursor_character_absolute (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_cursor_character_absolute (VteBuffer *buffer, GValueArray *params)
{
- VteBuffer *buffer = terminal->term_pvt->buffer;
VteScreen *screen;
GValue *value;
long val;
- screen = terminal->pvt->screen;
+ screen = buffer->pvt->screen;
val = 0;
if ((params != NULL) && (params->n_values > 0)) {
value = g_value_array_get_nth(params, 0);
if (G_VALUE_HOLDS_LONG(value)) {
val = CLAMP(g_value_get_long(value),
- 1, terminal->pvt->column_count) - 1;
+ 1, buffer->pvt->column_count) - 1;
}
}
@@ -2373,43 +2351,43 @@ vte_sequence_handler_cursor_character_absolute (VteTerminal *terminal, GValueArr
/* Move the cursor to the given position, 1-based. */
static void
-vte_sequence_handler_cursor_position (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_cursor_position (VteBuffer *buffer, GValueArray *params)
{
- vte_sequence_handler_offset(terminal, params, -1, vte_sequence_handler_cm);
+ vte_sequence_handler_offset(buffer, params, -1, vte_sequence_handler_cm);
}
/* Request terminal attributes. */
static void
-vte_sequence_handler_request_terminal_parameters (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_request_terminal_parameters (VteBuffer *buffer, GValueArray *params)
{
- vte_terminal_feed_child(terminal, "\e[?x", -1);
+ vte_buffer_feed_child(buffer, "\e[?x", -1);
}
/* Request terminal attributes. */
static void
-vte_sequence_handler_return_terminal_status (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_return_terminal_status (VteBuffer *buffer, GValueArray *params)
{
- vte_terminal_feed_child(terminal, "", 0);
+ vte_buffer_feed_child(buffer, "", 0);
}
/* Send primary device attributes. */
static void
-vte_sequence_handler_send_primary_device_attributes (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_send_primary_device_attributes (VteBuffer *buffer, GValueArray *params)
{
/* Claim to be a VT220 with only national character set support. */
- vte_terminal_feed_child(terminal, "\e[?62;9;c", -1);
+ vte_buffer_feed_child(buffer, "\e[?62;9;c", -1);
}
/* Send terminal ID. */
static void
-vte_sequence_handler_return_terminal_id (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_return_terminal_id (VteBuffer *buffer, GValueArray *params)
{
- vte_sequence_handler_send_primary_device_attributes (terminal, params);
+ vte_sequence_handler_send_primary_device_attributes (buffer, params);
}
/* Send secondary device attributes. */
static void
-vte_sequence_handler_send_secondary_device_attributes (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_send_secondary_device_attributes (VteBuffer *buffer, GValueArray *params)
{
char **version;
char buf[128];
@@ -2425,38 +2403,38 @@ vte_sequence_handler_send_secondary_device_attributes (VteTerminal *terminal, GV
g_strfreev(version);
}
g_snprintf(buf, sizeof (buf), _VTE_CAP_ESC "[>1;%ld;0c", ver);
- vte_terminal_feed_child(terminal, buf, -1);
+ vte_buffer_feed_child(buffer, buf, -1);
}
/* Set one or the other. */
static void
-vte_sequence_handler_set_icon_title (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_set_icon_title (VteBuffer *buffer, GValueArray *params)
{
- vte_sequence_handler_set_title_internal(terminal, params, TRUE, FALSE);
+ vte_sequence_handler_set_title_internal(buffer, params, TRUE, FALSE);
}
static void
-vte_sequence_handler_set_window_title (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_set_window_title (VteBuffer *buffer, GValueArray *params)
{
- vte_sequence_handler_set_title_internal(terminal, params, FALSE, TRUE);
+ vte_sequence_handler_set_title_internal(buffer, params, FALSE, TRUE);
}
/* Set both the window and icon titles to the same string. */
static void
-vte_sequence_handler_set_icon_and_window_title (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_set_icon_and_window_title (VteBuffer *buffer, GValueArray *params)
{
- vte_sequence_handler_set_title_internal(terminal, params, TRUE, TRUE);
+ vte_sequence_handler_set_title_internal(buffer, params, TRUE, TRUE);
}
/* Restrict the scrolling region. */
static void
-vte_sequence_handler_set_scrolling_region (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_set_scrolling_region (VteBuffer *buffer, GValueArray *params)
{
- vte_sequence_handler_offset(terminal, params, -1, vte_sequence_handler_cs);
+ vte_sequence_handler_offset(buffer, params, -1, vte_sequence_handler_cs);
}
static void
-vte_sequence_handler_set_scrolling_region_from_start (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_set_scrolling_region_from_start (VteBuffer *buffer, GValueArray *params)
{
GValue value = {0};
@@ -2465,11 +2443,11 @@ vte_sequence_handler_set_scrolling_region_from_start (VteTerminal *terminal, GVa
g_value_array_insert (params, 0, &value);
- vte_sequence_handler_offset(terminal, params, -1, vte_sequence_handler_cs);
+ vte_sequence_handler_offset(buffer, params, -1, vte_sequence_handler_cs);
}
static void
-vte_sequence_handler_set_scrolling_region_to_end (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_set_scrolling_region_to_end (VteBuffer *buffer, GValueArray *params)
{
GValue value = {0};
@@ -2478,41 +2456,41 @@ vte_sequence_handler_set_scrolling_region_to_end (VteTerminal *terminal, GValueA
g_value_array_insert (params, 1, &value);
- vte_sequence_handler_offset(terminal, params, -1, vte_sequence_handler_cs);
+ vte_sequence_handler_offset(buffer, params, -1, vte_sequence_handler_cs);
}
/* Set the application or normal keypad. */
static void
-vte_sequence_handler_application_keypad (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_application_keypad (VteBuffer *buffer, GValueArray *params)
{
_vte_debug_print(VTE_DEBUG_KEYBOARD,
"Entering application keypad mode.\n");
- terminal->pvt->keypad_mode = VTE_KEYMODE_APPLICATION;
+ buffer->pvt->keypad_mode = VTE_KEYMODE_APPLICATION;
}
static void
-vte_sequence_handler_normal_keypad (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_normal_keypad (VteBuffer *buffer, GValueArray *params)
{
_vte_debug_print(VTE_DEBUG_KEYBOARD,
"Leaving application keypad mode.\n");
- terminal->pvt->keypad_mode = VTE_KEYMODE_NORMAL;
+ buffer->pvt->keypad_mode = VTE_KEYMODE_NORMAL;
}
/* Move the cursor. */
static void
-vte_sequence_handler_character_position_absolute (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_character_position_absolute (VteBuffer *buffer, GValueArray *params)
{
- vte_sequence_handler_offset(terminal, params, -1, vte_sequence_handler_ch);
+ vte_sequence_handler_offset(buffer, params, -1, vte_sequence_handler_ch);
}
static void
-vte_sequence_handler_line_position_absolute (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_line_position_absolute (VteBuffer *buffer, GValueArray *params)
{
- vte_sequence_handler_offset(terminal, params, -1, vte_sequence_handler_cv);
+ vte_sequence_handler_offset(buffer, params, -1, vte_sequence_handler_cv);
}
/* Set certain terminal attributes. */
static void
-vte_sequence_handler_set_mode (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_set_mode (VteBuffer *buffer, GValueArray *params)
{
guint i;
long setting;
@@ -2526,13 +2504,13 @@ vte_sequence_handler_set_mode (VteTerminal *terminal, GValueArray *params)
continue;
}
setting = g_value_get_long(value);
- vte_sequence_handler_set_mode_internal(terminal, setting, TRUE);
+ vte_sequence_handler_set_mode_internal(buffer, setting, TRUE);
}
}
/* Unset certain terminal attributes. */
static void
-vte_sequence_handler_reset_mode (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_reset_mode (VteBuffer *buffer, GValueArray *params)
{
guint i;
long setting;
@@ -2546,13 +2524,13 @@ vte_sequence_handler_reset_mode (VteTerminal *terminal, GValueArray *params)
continue;
}
setting = g_value_get_long(value);
- vte_sequence_handler_set_mode_internal(terminal, setting, FALSE);
+ vte_sequence_handler_set_mode_internal(buffer, setting, FALSE);
}
}
/* Set certain terminal attributes. */
static void
-vte_sequence_handler_decset (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_decset (VteBuffer *buffer, GValueArray *params)
{
GValue *value;
long setting;
@@ -2566,13 +2544,13 @@ vte_sequence_handler_decset (VteTerminal *terminal, GValueArray *params)
continue;
}
setting = g_value_get_long(value);
- vte_sequence_handler_decset_internal(terminal, setting, FALSE, FALSE, TRUE);
+ vte_sequence_handler_decset_internal(buffer, setting, FALSE, FALSE, TRUE);
}
}
/* Unset certain terminal attributes. */
static void
-vte_sequence_handler_decreset (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_decreset (VteBuffer *buffer, GValueArray *params)
{
GValue *value;
long setting;
@@ -2586,20 +2564,20 @@ vte_sequence_handler_decreset (VteTerminal *terminal, GValueArray *params)
continue;
}
setting = g_value_get_long(value);
- vte_sequence_handler_decset_internal(terminal, setting, FALSE, FALSE, FALSE);
+ vte_sequence_handler_decset_internal(buffer, setting, FALSE, FALSE, FALSE);
}
}
/* Erase a specified number of characters. */
static void
-vte_sequence_handler_erase_characters (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_erase_characters (VteBuffer *buffer, GValueArray *params)
{
- vte_sequence_handler_ec (terminal, params);
+ vte_sequence_handler_ec (buffer, params);
}
/* Erase certain lines in the display. */
static void
-vte_sequence_handler_erase_in_display (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_erase_in_display (VteBuffer *buffer, GValueArray *params)
{
GValue *value;
long param;
@@ -2618,29 +2596,29 @@ vte_sequence_handler_erase_in_display (VteTerminal *terminal, GValueArray *param
switch (param) {
case 0:
/* Clear below the current line. */
- vte_sequence_handler_cd (terminal, NULL);
+ vte_sequence_handler_cd (buffer, NULL);
break;
case 1:
/* Clear above the current line. */
- _vte_buffer_clear_above_current (terminal->term_pvt->buffer);
+ _vte_buffer_clear_above_current (buffer);
/* Clear everything to the left of the cursor, too. */
/* FIXME: vttest. */
- vte_sequence_handler_cb (terminal, NULL);
+ vte_sequence_handler_cb (buffer, NULL);
break;
case 2:
/* Clear the entire screen. */
- _vte_buffer_clear_screen (terminal->term_pvt->buffer);
+ _vte_buffer_clear_screen (buffer);
break;
default:
break;
}
/* We've modified the display. Make a note of it. */
- terminal->pvt->text_deleted_flag = TRUE;
+ buffer->pvt->text_deleted_flag = TRUE;
}
/* Erase certain parts of the current line in the display. */
static void
-vte_sequence_handler_erase_in_line (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_erase_in_line (VteBuffer *buffer, GValueArray *params)
{
GValue *value;
long param;
@@ -2659,46 +2637,46 @@ vte_sequence_handler_erase_in_line (VteTerminal *terminal, GValueArray *params)
switch (param) {
case 0:
/* Clear to end of the line. */
- vte_sequence_handler_ce (terminal, NULL);
+ vte_sequence_handler_ce (buffer, NULL);
break;
case 1:
/* Clear to start of the line. */
- vte_sequence_handler_cb (terminal, NULL);
+ vte_sequence_handler_cb (buffer, NULL);
break;
case 2:
/* Clear the entire line. */
- _vte_buffer_clear_current_line (terminal->term_pvt->buffer);
+ _vte_buffer_clear_current_line (buffer);
break;
default:
break;
}
/* We've modified the display. Make a note of it. */
- terminal->pvt->text_deleted_flag = TRUE;
+ buffer->pvt->text_deleted_flag = TRUE;
}
/* Perform a full-bore reset. */
static void
-vte_sequence_handler_full_reset (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_full_reset (VteBuffer *buffer, GValueArray *params)
{
- vte_buffer_reset(terminal->term_pvt->buffer, TRUE, TRUE);
+ vte_buffer_reset(buffer, TRUE, TRUE);
}
/* Insert a specified number of blank characters. */
static void
-vte_sequence_handler_insert_blank_characters (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_insert_blank_characters (VteBuffer *buffer, GValueArray *params)
{
- vte_sequence_handler_IC (terminal, params);
+ vte_sequence_handler_IC (buffer, params);
}
/* Insert a certain number of lines below the current cursor. */
static void
-vte_sequence_handler_insert_lines (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_insert_lines (VteBuffer *buffer, GValueArray *params)
{
GValue *value;
VteScreen *screen;
long param, end, row;
int i;
- screen = terminal->pvt->screen;
+ screen = buffer->pvt->screen;
/* The default is one. */
param = 1;
/* Extract any parameters. */
@@ -2713,33 +2691,33 @@ vte_sequence_handler_insert_lines (VteTerminal *terminal, GValueArray *params)
if (screen->scrolling_restricted) {
end = screen->insert_delta + screen->scrolling_region.end;
} else {
- end = screen->insert_delta + terminal->pvt->row_count - 1;
+ end = screen->insert_delta + buffer->pvt->row_count - 1;
}
/* Insert the new lines at the cursor. */
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_buffer_ring_remove (terminal->term_pvt->buffer, end);
- _vte_buffer_ring_insert (terminal->term_pvt->buffer, row, TRUE);
+ _vte_buffer_ring_remove (buffer, end);
+ _vte_buffer_ring_insert (buffer, row, TRUE);
}
/* Update the display. */
- _vte_terminal_scroll_region(terminal, row, end - row + 1, param);
+ _vte_terminal_scroll_region(buffer->pvt->terminal, row, end - row + 1, param);
/* Adjust the scrollbars if necessary. */
- _vte_terminal_adjust_adjustments(terminal);
+ _vte_terminal_adjust_adjustments(buffer->pvt->terminal);
/* We've modified the display. Make a note of it. */
- terminal->pvt->text_inserted_flag = TRUE;
+ buffer->pvt->text_inserted_flag = TRUE;
}
/* Delete certain lines from the scrolling region. */
static void
-vte_sequence_handler_delete_lines (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_delete_lines (VteBuffer *buffer, GValueArray *params)
{
GValue *value;
VteScreen *screen;
long param, end, row;
int i;
- screen = terminal->pvt->screen;
+ screen = buffer->pvt->screen;
/* The default is one. */
param = 1;
/* Extract any parameters. */
@@ -2754,49 +2732,49 @@ vte_sequence_handler_delete_lines (VteTerminal *terminal, GValueArray *params)
if (screen->scrolling_restricted) {
end = screen->insert_delta + screen->scrolling_region.end;
} else {
- end = screen->insert_delta + terminal->pvt->row_count - 1;
+ end = screen->insert_delta + buffer->pvt->row_count - 1;
}
/* Clear them from below the current cursor. */
for (i = 0; i < param; i++) {
/* Insert a line at the end of the region and remove one from
* the top of the region. */
- _vte_buffer_ring_remove (terminal->term_pvt->buffer, row);
- _vte_buffer_ring_insert (terminal->term_pvt->buffer, end, TRUE);
+ _vte_buffer_ring_remove (buffer, row);
+ _vte_buffer_ring_insert (buffer, end, TRUE);
}
/* Update the display. */
- _vte_terminal_scroll_region(terminal, row, end - row + 1, -param);
+ _vte_terminal_scroll_region(buffer->pvt->terminal, row, end - row + 1, -param);
/* Adjust the scrollbars if necessary. */
- _vte_terminal_adjust_adjustments(terminal);
+ _vte_terminal_adjust_adjustments(buffer->pvt->terminal);
/* We've modified the display. Make a note of it. */
- terminal->pvt->text_deleted_flag = TRUE;
+ buffer->pvt->text_deleted_flag = TRUE;
}
/* Set the terminal encoding. */
static void
-vte_sequence_handler_local_charset (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_local_charset (VteBuffer *buffer, GValueArray *params)
{
const char *locale_encoding;
g_get_charset(&locale_encoding);
- vte_buffer_set_encoding(terminal->term_pvt->buffer, locale_encoding);
+ vte_buffer_set_encoding(buffer, locale_encoding);
}
static void
-vte_sequence_handler_utf_8_charset (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_utf_8_charset (VteBuffer *buffer, GValueArray *params)
{
- vte_buffer_set_encoding(terminal->term_pvt->buffer, "UTF-8");
+ vte_buffer_set_encoding(buffer, "UTF-8");
}
/* Device status reports. The possible reports are the cursor position and
* whether or not we're okay. */
static void
-vte_sequence_handler_device_status_report (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_device_status_report (VteBuffer *buffer, GValueArray *params)
{
GValue *value;
VteScreen *screen;
long param;
char buf[128];
- screen = terminal->pvt->screen;
+ screen = buffer->pvt->screen;
if ((params != NULL) && (params->n_values > 0)) {
value = g_value_array_get_nth(params, 0);
@@ -2805,7 +2783,7 @@ vte_sequence_handler_device_status_report (VteTerminal *terminal, GValueArray *p
switch (param) {
case 5:
/* Send a thumbs-up sequence. */
- vte_terminal_feed_child(terminal, _VTE_CAP_CSI "0n", -1);
+ vte_buffer_feed_child(buffer, _VTE_CAP_CSI "0n", -1);
break;
case 6:
/* Send the cursor position. */
@@ -2814,7 +2792,7 @@ vte_sequence_handler_device_status_report (VteTerminal *terminal, GValueArray *p
screen->cursor_current.row + 1 -
screen->insert_delta,
screen->cursor_current.col + 1);
- vte_terminal_feed_child(terminal, buf, -1);
+ vte_buffer_feed_child(buffer, buf, -1);
break;
default:
break;
@@ -2825,14 +2803,14 @@ vte_sequence_handler_device_status_report (VteTerminal *terminal, GValueArray *p
/* DEC-style device status reports. */
static void
-vte_sequence_handler_dec_device_status_report (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_dec_device_status_report (VteBuffer *buffer, GValueArray *params)
{
GValue *value;
VteScreen *screen;
long param;
char buf[128];
- screen = terminal->pvt->screen;
+ screen = buffer->pvt->screen;
if ((params != NULL) && (params->n_values > 0)) {
value = g_value_array_get_nth(params, 0);
@@ -2846,22 +2824,22 @@ vte_sequence_handler_dec_device_status_report (VteTerminal *terminal, GValueArra
screen->cursor_current.row + 1 -
screen->insert_delta,
screen->cursor_current.col + 1);
- vte_terminal_feed_child(terminal, buf, -1);
+ vte_buffer_feed_child(buffer, buf, -1);
break;
case 15:
/* Send printer status -- 10 = ready,
* 11 = not ready. We don't print. */
- vte_terminal_feed_child(terminal, _VTE_CAP_CSI "?11n", -1);
+ vte_buffer_feed_child(buffer, _VTE_CAP_CSI "?11n", -1);
break;
case 25:
/* Send UDK status -- 20 = locked,
* 21 = not locked. I don't even know what
* that means, but punt anyway. */
- vte_terminal_feed_child(terminal, _VTE_CAP_CSI "?20n", -1);
+ vte_buffer_feed_child(buffer, _VTE_CAP_CSI "?20n", -1);
break;
case 26:
/* Send keyboard status. 50 = no locator. */
- vte_terminal_feed_child(terminal, _VTE_CAP_CSI "?50n", -1);
+ vte_buffer_feed_child(buffer, _VTE_CAP_CSI "?50n", -1);
break;
default:
break;
@@ -2872,7 +2850,7 @@ vte_sequence_handler_dec_device_status_report (VteTerminal *terminal, GValueArra
/* Restore a certain terminal attribute. */
static void
-vte_sequence_handler_restore_mode (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_restore_mode (VteBuffer *buffer, GValueArray *params)
{
GValue *value;
long setting;
@@ -2886,13 +2864,13 @@ vte_sequence_handler_restore_mode (VteTerminal *terminal, GValueArray *params)
continue;
}
setting = g_value_get_long(value);
- vte_sequence_handler_decset_internal(terminal, setting, TRUE, FALSE, FALSE);
+ vte_sequence_handler_decset_internal(buffer, setting, TRUE, FALSE, FALSE);
}
}
/* Save a certain terminal attribute. */
static void
-vte_sequence_handler_save_mode (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_save_mode (VteBuffer *buffer, GValueArray *params)
{
GValue *value;
long setting;
@@ -2906,60 +2884,60 @@ vte_sequence_handler_save_mode (VteTerminal *terminal, GValueArray *params)
continue;
}
setting = g_value_get_long(value);
- vte_sequence_handler_decset_internal(terminal, setting, FALSE, TRUE, FALSE);
+ vte_sequence_handler_decset_internal(buffer, setting, FALSE, TRUE, FALSE);
}
}
/* Perform a screen alignment test -- fill all visible cells with the
* letter "E". */
static void
-vte_sequence_handler_screen_alignment_test (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_screen_alignment_test (VteBuffer *buffer, GValueArray *params)
{
long row;
VteRowData *rowdata;
VteScreen *screen;
VteCell cell;
- screen = terminal->pvt->screen;
+ screen = buffer->pvt->screen;
- for (row = terminal->pvt->screen->insert_delta;
- row < terminal->pvt->screen->insert_delta + terminal->pvt->row_count;
+ for (row = buffer->pvt->screen->insert_delta;
+ row < buffer->pvt->screen->insert_delta + buffer->pvt->row_count;
row++) {
/* Find this row. */
while (_vte_ring_next(screen->row_data) <= row)
- _vte_buffer_ring_append (terminal->term_pvt->buffer, FALSE);
- _vte_terminal_adjust_adjustments(terminal);
+ _vte_buffer_ring_append (buffer, FALSE);
+ _vte_terminal_adjust_adjustments(buffer->pvt->terminal);
rowdata = _vte_ring_index_writable (screen->row_data, row);
g_assert(rowdata != NULL);
/* Clear this row. */
_vte_row_data_shrink (rowdata, 0);
- _vte_buffer_emit_text_deleted(terminal->term_pvt->buffer);
+ _vte_buffer_emit_text_deleted(buffer);
/* Fill this row. */
cell.c = 'E';
cell.attr = basic_cell.cell.attr;
cell.attr.columns = 1;
- _vte_row_data_fill (rowdata, &cell, terminal->pvt->column_count);
- _vte_buffer_emit_text_inserted(terminal->term_pvt->buffer);
+ _vte_row_data_fill (rowdata, &cell, buffer->pvt->column_count);
+ _vte_buffer_emit_text_inserted(buffer);
}
- _vte_invalidate_all(terminal);
+ _vte_invalidate_all(buffer->pvt->terminal);
/* We modified the display, so make a note of it for completeness. */
- terminal->pvt->text_modified_flag = TRUE;
+ buffer->pvt->text_modified_flag = TRUE;
}
/* Perform a soft reset. */
static void
-vte_sequence_handler_soft_reset (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_soft_reset (VteBuffer *buffer, GValueArray *params)
{
- vte_buffer_reset(terminal->term_pvt->buffer, FALSE, FALSE);
+ vte_buffer_reset(buffer, FALSE, FALSE);
}
/* Window manipulation control sequences. Most of these are considered
* bad ideas, but they're implemented as signals which the application
* is free to ignore, so they're harmless. */
static void
-vte_sequence_handler_window_manipulation (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_window_manipulation (VteBuffer *buffer, GValueArray *params)
{
GdkScreen *gscreen;
VteScreen *screen;
@@ -2971,8 +2949,8 @@ vte_sequence_handler_window_manipulation (VteTerminal *terminal, GValueArray *pa
guint i;
GtkAllocation allocation;
- widget = &terminal->widget;
- screen = terminal->pvt->screen;
+ widget = &buffer->pvt->terminal->widget;
+ screen = buffer->pvt->screen;
for (i = 0; ((params != NULL) && (i < params->n_values)); i++) {
arg1 = arg2 = -1;
@@ -2997,19 +2975,19 @@ vte_sequence_handler_window_manipulation (VteTerminal *terminal, GValueArray *pa
case 1:
_vte_debug_print(VTE_DEBUG_PARSE,
"Deiconifying window.\n");
- _vte_buffer_emit_deiconify_window(terminal->term_pvt->buffer);
+ _vte_buffer_emit_deiconify_window(buffer);
break;
case 2:
_vte_debug_print(VTE_DEBUG_PARSE,
"Iconifying window.\n");
- _vte_buffer_emit_iconify_window(terminal->term_pvt->buffer);
+ _vte_buffer_emit_iconify_window(buffer);
break;
case 3:
if ((arg1 != -1) && (arg2 != -2)) {
_vte_debug_print(VTE_DEBUG_PARSE,
"Moving window to "
"%ld,%ld.\n", arg1, arg2);
- _vte_buffer_emit_move_window(terminal->term_pvt->buffer,
+ _vte_buffer_emit_move_window(buffer,
arg1, arg2);
i += 2;
}
@@ -3020,29 +2998,29 @@ vte_sequence_handler_window_manipulation (VteTerminal *terminal, GValueArray *pa
"Resizing window "
"(to %ldx%ld pixels).\n",
arg2, arg1);
- _vte_buffer_emit_resize_window(terminal->term_pvt->buffer,
+ _vte_buffer_emit_resize_window(buffer,
arg2 +
- terminal->pvt->padding.left +
- terminal->pvt->padding.right,
+ buffer->pvt->padding.left +
+ buffer->pvt->padding.right,
arg1 +
- terminal->pvt->padding.top +
- terminal->pvt->padding.bottom);
+ buffer->pvt->padding.top +
+ buffer->pvt->padding.bottom);
i += 2;
}
break;
case 5:
_vte_debug_print(VTE_DEBUG_PARSE, "Raising window.\n");
- _vte_buffer_emit_raise_window(terminal->term_pvt->buffer);
+ _vte_buffer_emit_raise_window(buffer);
break;
case 6:
_vte_debug_print(VTE_DEBUG_PARSE, "Lowering window.\n");
- _vte_buffer_emit_lower_window(terminal->term_pvt->buffer);
+ _vte_buffer_emit_lower_window(buffer);
break;
case 7:
_vte_debug_print(VTE_DEBUG_PARSE,
"Refreshing window.\n");
- _vte_invalidate_all(terminal);
- _vte_buffer_emit_refresh_window(terminal->term_pvt->buffer);
+ _vte_invalidate_all(buffer->pvt->terminal);
+ _vte_buffer_emit_refresh_window(buffer);
break;
case 8:
if ((arg1 != -1) && (arg2 != -1)) {
@@ -3050,13 +3028,13 @@ vte_sequence_handler_window_manipulation (VteTerminal *terminal, GValueArray *pa
"Resizing window "
"(to %ld columns, %ld rows).\n",
arg2, arg1);
- _vte_buffer_emit_resize_window(terminal->term_pvt->buffer,
- arg2 * terminal->pvt->char_width +
- terminal->pvt->padding.left +
- terminal->pvt->padding.right,
- arg1 * terminal->pvt->char_height +
- terminal->pvt->padding.top +
- terminal->pvt->padding.bottom);
+ _vte_buffer_emit_resize_window(buffer,
+ arg2 * buffer->pvt->char_width +
+ buffer->pvt->padding.left +
+ buffer->pvt->padding.right,
+ arg1 * buffer->pvt->char_height +
+ buffer->pvt->padding.top +
+ buffer->pvt->padding.bottom);
i += 2;
}
break;
@@ -3065,12 +3043,12 @@ vte_sequence_handler_window_manipulation (VteTerminal *terminal, GValueArray *pa
case 0:
_vte_debug_print(VTE_DEBUG_PARSE,
"Restoring window.\n");
- _vte_buffer_emit_restore_window(terminal->term_pvt->buffer);
+ _vte_buffer_emit_restore_window(buffer);
break;
case 1:
_vte_debug_print(VTE_DEBUG_PARSE,
"Maximizing window.\n");
- _vte_buffer_emit_maximize_window(terminal->term_pvt->buffer);
+ _vte_buffer_emit_maximize_window(buffer);
break;
default:
break;
@@ -3086,7 +3064,7 @@ vte_sequence_handler_window_manipulation (VteTerminal *terminal, GValueArray *pa
"Reporting window state %s.\n",
gtk_widget_get_mapped(widget) ?
"non-iconified" : "iconified");
- vte_terminal_feed_child(terminal, buf, -1);
+ vte_buffer_feed_child(buffer, buf, -1);
break;
case 13:
/* Send window location, in pixels. */
@@ -3094,13 +3072,13 @@ vte_sequence_handler_window_manipulation (VteTerminal *terminal, GValueArray *pa
&width, &height);
g_snprintf(buf, sizeof(buf),
_VTE_CAP_CSI "3;%d;%dt",
- width + terminal->pvt->padding.left,
- height + terminal->pvt->padding.top);
+ width + buffer->pvt->padding.left,
+ height + buffer->pvt->padding.top);
_vte_debug_print(VTE_DEBUG_PARSE,
"Reporting window location"
"(%d++,%d++).\n",
width, height);
- vte_terminal_feed_child(terminal, buf, -1);
+ vte_buffer_feed_child(buffer, buf, -1);
break;
case 14:
/* Send window size, in pixels. */
@@ -3108,17 +3086,17 @@ vte_sequence_handler_window_manipulation (VteTerminal *terminal, GValueArray *pa
g_snprintf(buf, sizeof(buf),
_VTE_CAP_CSI "4;%d;%dt",
allocation.height -
- (terminal->pvt->padding.top +
- terminal->pvt->padding.bottom),
+ (buffer->pvt->padding.top +
+ buffer->pvt->padding.bottom),
allocation.width -
- (terminal->pvt->padding.left +
- terminal->pvt->padding.right));
+ (buffer->pvt->padding.left +
+ buffer->pvt->padding.right));
_vte_debug_print(VTE_DEBUG_PARSE,
"Reporting window size "
"(%dx%dn",
- width - (terminal->pvt->padding.left + terminal->pvt->padding.right),
- height - (terminal->pvt->padding.top + terminal->pvt->padding.bottom));
- vte_terminal_feed_child(terminal, buf, -1);
+ width - (buffer->pvt->padding.left + buffer->pvt->padding.right),
+ height - (buffer->pvt->padding.top + buffer->pvt->padding.bottom));
+ vte_buffer_feed_child(buffer, buf, -1);
break;
case 18:
/* Send widget size, in cells. */
@@ -3126,9 +3104,9 @@ vte_sequence_handler_window_manipulation (VteTerminal *terminal, GValueArray *pa
"Reporting widget size.\n");
g_snprintf(buf, sizeof(buf),
_VTE_CAP_CSI "8;%ld;%ldt",
- terminal->pvt->row_count,
- terminal->pvt->column_count);
- vte_terminal_feed_child(terminal, buf, -1);
+ buffer->pvt->row_count,
+ buffer->pvt->column_count);
+ vte_buffer_feed_child(buffer, buf, -1);
break;
case 19:
_vte_debug_print(VTE_DEBUG_PARSE,
@@ -3138,9 +3116,9 @@ vte_sequence_handler_window_manipulation (VteTerminal *terminal, GValueArray *pa
width = gdk_screen_get_width(gscreen);
g_snprintf(buf, sizeof(buf),
_VTE_CAP_CSI "9;%ld;%ldt",
- height / terminal->pvt->char_height,
- width / terminal->pvt->char_width);
- vte_terminal_feed_child(terminal, buf, -1);
+ height / buffer->pvt->char_height,
+ width / buffer->pvt->char_width);
+ vte_buffer_feed_child(buffer, buf, -1);
break;
case 20:
/* Report a static icon title, since the real
@@ -3150,10 +3128,10 @@ vte_sequence_handler_window_manipulation (VteTerminal *terminal, GValueArray *pa
and CVE-2003-0070. */
_vte_debug_print(VTE_DEBUG_PARSE,
"Reporting fake icon title.\n");
- /* never use terminal->pvt->icon_title here! */
+ /* never use buffer->pvt->icon_title here! */
g_snprintf (buf, sizeof (buf),
_VTE_CAP_OSC "LTerminal" _VTE_CAP_ST);
- vte_terminal_feed_child(terminal, buf, -1);
+ vte_buffer_feed_child(buffer, buf, -1);
break;
case 21:
/* Report a static window title, since the real
@@ -3163,10 +3141,10 @@ vte_sequence_handler_window_manipulation (VteTerminal *terminal, GValueArray *pa
and CVE-2003-0070. */
_vte_debug_print(VTE_DEBUG_PARSE,
"Reporting fake window title.\n");
- /* never use terminal->pvt->window_title here! */
+ /* never use buffer->pvt->window_title here! */
g_snprintf (buf, sizeof (buf),
_VTE_CAP_OSC "lTerminal" _VTE_CAP_ST);
- vte_terminal_feed_child(terminal, buf, -1);
+ vte_buffer_feed_child(buffer, buf, -1);
break;
default:
if (param >= 24) {
@@ -3175,13 +3153,13 @@ vte_sequence_handler_window_manipulation (VteTerminal *terminal, GValueArray *pa
param);
/* Resize to the specified number of
* rows. */
- _vte_buffer_emit_resize_window(terminal->term_pvt->buffer,
- terminal->pvt->column_count * terminal->pvt->char_width +
- terminal->pvt->padding.left +
- terminal->pvt->padding.right,
- param * terminal->pvt->char_height +
- terminal->pvt->padding.top +
- terminal->pvt->padding.bottom);
+ _vte_buffer_emit_resize_window(buffer,
+ buffer->pvt->column_count * buffer->pvt->char_width +
+ buffer->pvt->padding.left +
+ buffer->pvt->padding.right,
+ param * buffer->pvt->char_height +
+ buffer->pvt->padding.top +
+ buffer->pvt->padding.bottom);
}
break;
}
@@ -3190,7 +3168,7 @@ vte_sequence_handler_window_manipulation (VteTerminal *terminal, GValueArray *pa
/* Change the color of the cursor */
static void
-vte_sequence_handler_change_cursor_color (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_change_cursor_color (VteBuffer *buffer, GValueArray *params)
{
gchar *name = NULL;
GValue *value;
@@ -3202,22 +3180,22 @@ vte_sequence_handler_change_cursor_color (VteTerminal *terminal, GValueArray *pa
if (G_VALUE_HOLDS_STRING (value))
name = g_value_dup_string (value);
else if (G_VALUE_HOLDS_POINTER (value))
- name = vte_buffer_ucs4_to_utf8(terminal->term_pvt->buffer, g_value_get_pointer (value));
+ name = vte_buffer_ucs4_to_utf8(buffer, g_value_get_pointer (value));
if (! name)
return;
if (vte_parse_color (name, &color))
- _vte_terminal_set_effect_color(terminal, VTE_CUR_BG, &color,
+ _vte_terminal_set_effect_color(buffer->pvt->terminal, VTE_CUR_BG, &color,
VTE_TERMINAL_EFFECT_COLOR, TRUE);
else if (strcmp (name, "?") == 0) {
gchar buf[128];
g_snprintf (buf, sizeof (buf),
_VTE_CAP_OSC "12;rgb:%04x/%04x/%04x" BEL,
- (guint) (terminal->pvt->palette[VTE_CUR_BG].red * 65535.),
- (guint) (terminal->pvt->palette[VTE_CUR_BG].green * 65535.),
- (guint) (terminal->pvt->palette[VTE_CUR_BG].blue * 65535.));
- vte_terminal_feed_child (terminal, buf, -1);
+ (guint) (buffer->pvt->palette[VTE_CUR_BG].red * 65535.),
+ (guint) (buffer->pvt->palette[VTE_CUR_BG].green * 65535.),
+ (guint) (buffer->pvt->palette[VTE_CUR_BG].blue * 65535.));
+ vte_buffer_feed_child (buffer, buf, -1);
}
g_free (name);
@@ -3260,7 +3238,7 @@ _vte_sequence_get_handler (const char *name)
/* Handle a terminal control sequence and its parameters. */
void
-_vte_terminal_handle_sequence(VteTerminal *terminal,
+_vte_terminal_handle_sequence(VteBuffer *buffer,
const char *match_s,
GQuark match G_GNUC_UNUSED,
GValueArray *params)
@@ -3275,7 +3253,7 @@ _vte_terminal_handle_sequence(VteTerminal *terminal,
if (handler != NULL) {
/* Let the handler handle it. */
- handler (terminal, params);
+ handler (buffer, params);
} else {
_vte_debug_print (VTE_DEBUG_MISC,
"No handler for control sequence `%s' defined.\n",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]