vte r2244 - in trunk: . src
- From: behdad svn gnome org
- To: svn-commits-list gnome org
- Subject: vte r2244 - in trunk: . src
- Date: Mon, 1 Dec 2008 02:55:00 +0000 (UTC)
Author: behdad
Date: Mon Dec 1 02:55:00 2008
New Revision: 2244
URL: http://svn.gnome.org/viewvc/vte?rev=2244&view=rev
Log:
2008-11-30 Behdad Esfahbod <behdad gnome org>
* src/vte-private.h:
* src/vte.c (_vte_terminal_scroll), (_vte_terminal_scroll_region):
* src/vteseq.c (vte_sequence_handler_scroll_down_one),
(vte_sequence_handler_scroll_up_one):
Move vte_terminal_scroll to vte.c
Modified:
trunk/ChangeLog
trunk/src/vte-private.h
trunk/src/vte.c
trunk/src/vteseq.c
Modified: trunk/src/vte-private.h
==============================================================================
--- trunk/src/vte-private.h (original)
+++ trunk/src/vte-private.h Mon Dec 1 02:55:00 2008
@@ -439,6 +439,8 @@
gboolean _vte_terminal_insert_char(VteTerminal *terminal, gunichar c,
gboolean force_insert_mode,
gboolean invalidate_cells);
+void _vte_terminal_scroll (VteTerminal *terminal,
+ int scroll_amount);
void _vte_terminal_scroll_region(VteTerminal *terminal,
long row, glong count, glong delta);
void _vte_terminal_set_default_attributes(VteTerminal *terminal);
Modified: trunk/src/vte.c
==============================================================================
--- trunk/src/vte.c (original)
+++ trunk/src/vte.c Mon Dec 1 02:55:00 2008
@@ -589,11 +589,64 @@
}
}
+/* Scroll the text, but don't move the cursor. Negative = up, positive = down. */
+void
+_vte_terminal_scroll (VteTerminal *terminal, int scroll_amount)
+{
+ VteRowData *row, *old_row;
+ long start, end, i;
+ VteScreen *screen;
+
+ screen = terminal->pvt->screen;
+
+ if (screen->scrolling_restricted) {
+ start = screen->insert_delta + screen->scrolling_region.start;
+ end = screen->insert_delta + screen->scrolling_region.end;
+ } else {
+ start = screen->insert_delta;
+ end = start + terminal->row_count - 1;
+ }
+
+ old_row = terminal->pvt->free_row;
+ while (_vte_ring_next(screen->row_data) <= end) {
+ if (old_row) {
+ row = _vte_reset_row_data (terminal, old_row, FALSE);
+ } else {
+ row = _vte_new_row_data_sized(terminal, FALSE);
+ }
+ old_row = _vte_ring_append(terminal->pvt->screen->row_data, row);
+ }
+ terminal->pvt->free_row = old_row;
+ if (scroll_amount > 0) {
+ for (i = 0; i < scroll_amount; i++) {
+ vte_remove_line_internal(terminal, end);
+ vte_insert_line_internal(terminal, start);
+ }
+ } else {
+ for (i = 0; i < -scroll_amount; i++) {
+ vte_remove_line_internal(terminal, start);
+ vte_insert_line_internal(terminal, end);
+ }
+ }
+
+ /* Update the display. */
+ _vte_terminal_scroll_region(terminal, start, end - start + 1,
+ scroll_amount);
+
+ /* Adjust the scrollbars if necessary. */
+ _vte_terminal_adjust_adjustments(terminal);
+
+ /* We've modified the display. Make a note of it. */
+ terminal->pvt->text_inserted_flag = TRUE;
+ terminal->pvt->text_deleted_flag = TRUE;
+}
+
+
/* Scroll a rectangular region up or down by a fixed number of lines,
* negative = up, positive = down. */
void
-_vte_terminal_scroll_region(VteTerminal *terminal,
- long row, glong count, glong delta)
+_vte_terminal_scroll_region (VteTerminal *terminal,
+ long row, glong count, glong delta)
{
if ((delta == 0) || (count == 0)) {
/* Shenanigans! */
Modified: trunk/src/vteseq.c
==============================================================================
--- trunk/src/vteseq.c (original)
+++ trunk/src/vteseq.c Mon Dec 1 02:55:00 2008
@@ -32,25 +32,6 @@
-/* A function which can handle a terminal control sequence. Returns TRUE only
- * if something happened (usually a signal emission) to which the controlling
- * application must have an immediate opportunity to respond. */
-typedef gboolean (*VteTerminalSequenceHandler)(VteTerminal *terminal,
- const char *match,
- GQuark match_quark,
- GValueArray *params);
-
-/* Prototype all handlers... */
-#define VTE_SEQUENCE_HANDLER(name) \
- static gboolean name(VteTerminal *terminal, \
- const char *match, \
- GQuark match_quark, \
- GValueArray *params);
-#include "vteseq-list.h"
-#undef VTE_SEQUENCE_HANDLER
-
-
-
/* FUNCTIONS WE USE */
@@ -238,6 +219,38 @@
+
+
+
+
+/*
+ * Sequence handling boilerplate
+ */
+
+
+
+
+
+/* A function which can handle a terminal control sequence. Returns TRUE only
+ * if something happened (usually a signal emission) to which the controlling
+ * application must have an immediate opportunity to respond. */
+typedef gboolean (*VteTerminalSequenceHandler)(VteTerminal *terminal,
+ const char *match,
+ GQuark match_quark,
+ GValueArray *params);
+
+/* Prototype all handlers... */
+#define VTE_SEQUENCE_HANDLER(name) \
+ static gboolean name(VteTerminal *terminal, \
+ const char *match, \
+ GQuark match_quark, \
+ GValueArray *params);
+#include "vteseq-list.h"
+#undef VTE_SEQUENCE_HANDLER
+
+
+
+
/* Call another function, offsetting any long arguments by the given
* increment value. */
static gboolean
@@ -291,61 +304,6 @@
return (again > 0);
}
-/* Scroll the text, but don't move the cursor. Negative = up,
- * positive = down. */
-static gboolean
-vte_sequence_handler_scroll_up_or_down(VteTerminal *terminal, int scroll_amount)
-{
- VteRowData *row, *old_row;
- long start, end, i;
- VteScreen *screen;
-
- screen = terminal->pvt->screen;
-
- if (screen->scrolling_restricted) {
- start = screen->insert_delta + screen->scrolling_region.start;
- end = screen->insert_delta + screen->scrolling_region.end;
- } else {
- start = screen->insert_delta;
- end = start + terminal->row_count - 1;
- }
-
- old_row = terminal->pvt->free_row;
- while (_vte_ring_next(screen->row_data) <= end) {
- if (old_row) {
- row = _vte_reset_row_data (terminal, old_row, FALSE);
- } else {
- row = _vte_new_row_data_sized(terminal, FALSE);
- }
- old_row = _vte_ring_append(terminal->pvt->screen->row_data, row);
- }
- terminal->pvt->free_row = old_row;
- if (scroll_amount > 0) {
- for (i = 0; i < scroll_amount; i++) {
- vte_remove_line_internal(terminal, end);
- vte_insert_line_internal(terminal, start);
- }
- } else {
- for (i = 0; i < -scroll_amount; i++) {
- vte_remove_line_internal(terminal, start);
- vte_insert_line_internal(terminal, end);
- }
- }
-
- /* Update the display. */
- _vte_terminal_scroll_region(terminal, start, end - start + 1,
- scroll_amount);
-
- /* Adjust the scrollbars if necessary. */
- _vte_terminal_adjust_adjustments(terminal);
-
- /* We've modified the display. Make a note of it. */
- terminal->pvt->text_inserted_flag = TRUE;
- terminal->pvt->text_deleted_flag = TRUE;
-
- return FALSE;
-}
-
/* Set icon/window titles. */
static gboolean
vte_sequence_handler_set_title_internal(VteTerminal *terminal,
@@ -2061,7 +2019,8 @@
GQuark match_quark,
GValueArray *params)
{
- return vte_sequence_handler_scroll_up_or_down(terminal, 1);
+ _vte_terminal_scroll (terminal, 1);
+ return FALSE;
}
/* Scroll the text down, but don't move the cursor. */
@@ -2082,7 +2041,8 @@
GQuark match_quark,
GValueArray *params)
{
- return vte_sequence_handler_scroll_up_or_down(terminal, -1);
+ _vte_terminal_scroll (terminal, -1);
+ return FALSE;
}
/* Scroll the text up, but don't move the cursor. */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]