[vte/vte-next: 120/223] Move some methods to VteBuffer
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vte/vte-next: 120/223] Move some methods to VteBuffer
- Date: Wed, 22 Jun 2011 20:58:41 +0000 (UTC)
commit 51348a7f12c0c7b6b4dabdf49fae98c53fd43e72
Author: Christian Persch <chpe gnome org>
Date: Thu Jun 9 14:01:33 2011 +0200
Move some methods to VteBuffer
src/vte-private.h | 11 +++++++----
src/vte.c | 34 ++++++++++++++++++++++------------
src/vteseq.c | 36 ++++++++++++++++++------------------
3 files changed, 47 insertions(+), 34 deletions(-)
---
diff --git a/src/vte-private.h b/src/vte-private.h
index c63e944..0e5446f 100644
--- a/src/vte-private.h
+++ b/src/vte-private.h
@@ -453,10 +453,6 @@ void _vte_terminal_beep(VteTerminal *terminal);
void _vte_terminal_inline_error_message(VteTerminal *terminal, const char *format, ...) G_GNUC_PRINTF(2,3);
-VteRowData *_vte_terminal_ring_insert (VteTerminal *terminal, glong position, gboolean fill);
-VteRowData *_vte_terminal_ring_append (VteTerminal *terminal, gboolean fill);
-void _vte_terminal_ring_remove (VteTerminal *terminal, glong position);
-
/* vteseq.c: */
void _vte_terminal_handle_sequence(VteTerminal *terminal,
const char *match_s,
@@ -479,6 +475,13 @@ void _vte_terminal_set_effect_color(VteTerminal *terminal,
VteTerminalEffect effect,
gboolean override);
+
+/* private VteBuffer methods */
+
+VteRowData *_vte_buffer_ring_insert (VteBuffer *buffer, glong position, gboolean fill);
+VteRowData *_vte_buffer_ring_append (VteBuffer *buffer, gboolean fill);
+void _vte_buffer_ring_remove (VteBuffer *buffer, glong position);
+
G_END_DECLS
#endif
diff --git a/src/vte.c b/src/vte.c
index 5555ee3..144c11d 100644
--- a/src/vte.c
+++ b/src/vte.c
@@ -289,30 +289,40 @@ vte_g_array_fill(GArray *array, gconstpointer item, guint final_size)
VteRowData *
-_vte_terminal_ring_insert (VteTerminal *terminal, glong position, gboolean fill)
+_vte_buffer_ring_insert (VteBuffer *buffer,
+ glong position,
+ gboolean fill)
{
VteRowData *row;
- VteRing *ring = terminal->pvt->screen->row_data;
+ VteScreen *screen;
+ VteRing *ring;
+
+ screen = buffer->pvt->screen;
+ ring = screen->row_data;
while (G_UNLIKELY (_vte_ring_next (ring) < position)) {
row = _vte_ring_append (ring);
- _vte_row_data_fill (row, &terminal->pvt->screen->fill_defaults, terminal->pvt->column_count);
+ _vte_row_data_fill (row, &screen->fill_defaults, buffer->pvt->column_count);
}
row = _vte_ring_insert (ring, position);
if (fill)
- _vte_row_data_fill (row, &terminal->pvt->screen->fill_defaults, terminal->pvt->column_count);
+ _vte_row_data_fill (row, &screen->fill_defaults, buffer->pvt->column_count);
return row;
}
VteRowData *
-_vte_terminal_ring_append (VteTerminal *terminal, gboolean fill)
+_vte_buffer_ring_append (VteBuffer *buffer,
+ gboolean fill)
{
- return _vte_terminal_ring_insert (terminal, _vte_ring_next (terminal->pvt->screen->row_data), fill);
+ return _vte_buffer_ring_insert (buffer,
+ _vte_ring_next (buffer->pvt->screen->row_data),
+ fill);
}
void
-_vte_terminal_ring_remove (VteTerminal *terminal, glong position)
+_vte_buffer_ring_remove (VteBuffer *buffer,
+ glong position)
{
- _vte_ring_remove (terminal->pvt->screen->row_data, position);
+ _vte_ring_remove (buffer->pvt->screen->row_data, position);
}
/* Reset defaults for character insertion. */
@@ -2030,7 +2040,7 @@ vte_terminal_insert_rows (VteTerminal *terminal, guint cnt)
{
VteRowData *row;
do {
- row = _vte_terminal_ring_append (terminal, FALSE);
+ row = _vte_buffer_ring_append (terminal->term_pvt->buffer, FALSE);
} while(--cnt);
return row;
}
@@ -2336,7 +2346,7 @@ _vte_terminal_cursor_down (VteTerminal *terminal)
* to insert_delta. */
start++;
end++;
- _vte_terminal_ring_insert (terminal, screen->cursor_current.row, FALSE);
+ _vte_buffer_ring_insert (terminal->term_pvt->buffer, screen->cursor_current.row, FALSE);
/* Force the areas below the region to be
* redrawn -- they've moved. */
_vte_terminal_scroll_region(terminal, start,
@@ -2347,8 +2357,8 @@ _vte_terminal_cursor_down (VteTerminal *terminal)
/* If we're at the bottom of the scrolling
* region, add a line at the top to scroll the
* bottom off. */
- _vte_terminal_ring_remove (terminal, start);
- _vte_terminal_ring_insert (terminal, end, TRUE);
+ _vte_buffer_ring_remove (terminal->term_pvt->buffer, start);
+ _vte_buffer_ring_insert (terminal->term_pvt->buffer, end, TRUE);
/* Update the display. */
_vte_terminal_scroll_region(terminal, start,
end - start + 1, -1);
diff --git a/src/vteseq.c b/src/vteseq.c
index ba2aae6..ed65c89 100644
--- a/src/vteseq.c
+++ b/src/vteseq.c
@@ -280,7 +280,7 @@ _vte_terminal_clear_screen (VteTerminal *terminal)
initial = _vte_ring_next(screen->row_data);
/* Add a new screen's worth of rows. */
for (i = 0; i < terminal->pvt->row_count; i++)
- _vte_terminal_ring_append (terminal, TRUE);
+ _vte_buffer_ring_append (terminal->term_pvt->buffer, TRUE);
/* Move the cursor and insertion delta to the first line in the
* newly-cleared area and scroll if need be. */
screen->insert_delta = initial;
@@ -369,17 +369,17 @@ _vte_terminal_scroll_text (VteTerminal *terminal, int scroll_amount)
}
while (_vte_ring_next(screen->row_data) <= end)
- _vte_terminal_ring_append (terminal, FALSE);
+ _vte_buffer_ring_append (terminal->term_pvt->buffer, FALSE);
if (scroll_amount > 0) {
for (i = 0; i < scroll_amount; i++) {
- _vte_terminal_ring_remove (terminal, end);
- _vte_terminal_ring_insert (terminal, start, TRUE);
+ _vte_buffer_ring_remove (terminal->term_pvt->buffer, end);
+ _vte_buffer_ring_insert (terminal->term_pvt->buffer, start, TRUE);
}
} else {
for (i = 0; i < -scroll_amount; i++) {
- _vte_terminal_ring_remove (terminal, start);
- _vte_terminal_ring_insert (terminal, end, TRUE);
+ _vte_buffer_ring_remove (terminal->term_pvt->buffer, start);
+ _vte_buffer_ring_insert (terminal->term_pvt->buffer, end, TRUE);
}
}
@@ -949,8 +949,8 @@ 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_terminal_ring_remove (terminal, end);
- _vte_terminal_ring_insert (terminal, start, TRUE);
+ _vte_buffer_ring_remove (terminal->term_pvt->buffer, end);
+ _vte_buffer_ring_insert (terminal->term_pvt->buffer, start, TRUE);
/* Adjust the scrollbars if necessary. */
_vte_terminal_adjust_adjustments(terminal);
}
@@ -1082,7 +1082,7 @@ vte_sequence_handler_cd (VteTerminal *terminal, GValueArray *params)
rowdata = _vte_ring_index_writable (screen->row_data, i);
g_assert(rowdata != NULL);
} else {
- rowdata = _vte_terminal_ring_append (terminal, FALSE);
+ rowdata = _vte_buffer_ring_append (terminal->term_pvt->buffer, FALSE);
}
/* Pad out the row. */
_vte_row_data_fill (rowdata, &screen->fill_defaults, terminal->pvt->column_count);
@@ -1428,8 +1428,8 @@ 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_terminal_ring_remove (terminal, start);
- _vte_terminal_ring_insert (terminal, end, TRUE);
+ _vte_buffer_ring_remove (terminal->term_pvt->buffer, start);
+ _vte_buffer_ring_insert (terminal->term_pvt->buffer, end, TRUE);
/* Adjust the scrollbars if necessary. */
_vte_terminal_adjust_adjustments(terminal);
}
@@ -1996,8 +1996,8 @@ vte_sequence_handler_sr (VteTerminal *terminal, GValueArray *params)
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_terminal_ring_remove (terminal, end);
- _vte_terminal_ring_insert (terminal, start, TRUE);
+ _vte_buffer_ring_remove (terminal->term_pvt->buffer, end);
+ _vte_buffer_ring_insert (terminal->term_pvt->buffer, start, TRUE);
/* Update the display. */
_vte_terminal_scroll_region(terminal, start, end - start + 1, 1);
_vte_invalidate_cells(terminal,
@@ -2802,8 +2802,8 @@ vte_sequence_handler_insert_lines (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_terminal_ring_remove (terminal, end);
- _vte_terminal_ring_insert (terminal, row, TRUE);
+ _vte_buffer_ring_remove (terminal->term_pvt->buffer, end);
+ _vte_buffer_ring_insert (terminal->term_pvt->buffer, row, TRUE);
}
/* Update the display. */
_vte_terminal_scroll_region(terminal, row, end - row + 1, param);
@@ -2843,8 +2843,8 @@ vte_sequence_handler_delete_lines (VteTerminal *terminal, GValueArray *params)
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_terminal_ring_remove (terminal, row);
- _vte_terminal_ring_insert (terminal, end, TRUE);
+ _vte_buffer_ring_remove (terminal->term_pvt->buffer, row);
+ _vte_buffer_ring_insert (terminal->term_pvt->buffer, end, TRUE);
}
/* Update the display. */
_vte_terminal_scroll_region(terminal, row, end - row + 1, -param);
@@ -3010,7 +3010,7 @@ vte_sequence_handler_screen_alignment_test (VteTerminal *terminal, GValueArray *
row++) {
/* Find this row. */
while (_vte_ring_next(screen->row_data) <= row)
- _vte_terminal_ring_append (terminal, FALSE);
+ _vte_buffer_ring_append (terminal->term_pvt->buffer, FALSE);
_vte_terminal_adjust_adjustments(terminal);
rowdata = _vte_ring_index_writable (screen->row_data, row);
g_assert(rowdata != NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]