[vte] emulation: Port DECSTBM to new parameter glue
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vte] emulation: Port DECSTBM to new parameter glue
- Date: Tue, 27 Mar 2018 17:43:33 +0000 (UTC)
commit 13b3ac515590c7e874c4317ae927e06743e10c22
Author: Christian Persch <chpe src gnome org>
Date: Tue Mar 27 19:40:12 2018 +0200
emulation: Port DECSTBM to new parameter glue
src/vteinternal.hh | 3 -
src/vteseq-list.hh | 3 -
src/vteseq.cc | 131 ++++++++++++++++++---------------------------------
3 files changed, 46 insertions(+), 91 deletions(-)
---
diff --git a/src/vteinternal.hh b/src/vteinternal.hh
index 183661b..5440e9a 100644
--- a/src/vteinternal.hh
+++ b/src/vteinternal.hh
@@ -1208,9 +1208,6 @@ public:
vte::grid::column_t column); /* 1-based */
inline vte::grid::row_t get_cursor_row() const;
inline vte::grid::column_t get_cursor_column() const;
- inline void reset_scrolling_region();
- inline void set_scrolling_region(vte::grid::row_t start /* relative */,
- vte::grid::row_t end /* relative */);
inline void move_cursor_up(vte::grid::row_t rows);
inline void move_cursor_down(vte::grid::row_t rows);
inline void erase_characters(long count);
diff --git a/src/vteseq-list.hh b/src/vteseq-list.hh
index 70ddeb9..6986057 100644
--- a/src/vteseq-list.hh
+++ b/src/vteseq-list.hh
@@ -100,9 +100,6 @@ SEQUENCE_HANDLER(set_current_hyperlink)
SEQUENCE_HANDLER(set_icon_and_window_title)
SEQUENCE_HANDLER(set_icon_title)
SEQUENCE_HANDLER(set_mode)
-SEQUENCE_HANDLER(set_scrolling_region)
-SEQUENCE_HANDLER(set_scrolling_region_from_start)
-SEQUENCE_HANDLER(set_scrolling_region_to_end)
SEQUENCE_HANDLER(set_text_property_21)
SEQUENCE_HANDLER(set_text_property_2L)
SEQUENCE_HANDLER(set_window_title)
diff --git a/src/vteseq.cc b/src/vteseq.cc
index 92baab5..4b2feca 100644
--- a/src/vteseq.cc
+++ b/src/vteseq.cc
@@ -1143,64 +1143,6 @@ VteTerminalPrivate::seq_carriage_return(vte::parser::Params const& params)
set_cursor_column(0);
}
-void
-VteTerminalPrivate::reset_scrolling_region()
-{
- m_scrolling_restricted = FALSE;
- home_cursor();
-}
-
-/* Restrict scrolling and updates to a subset of the visible lines. */
-void
-VteTerminalPrivate::seq_set_scrolling_region(vte::parser::Params const& params)
-{
- /* We require two parameters. Anything less is a reset. */
- // if (params.size() < 2)
- // return reset_scrolling_region();
-
- auto start = params.number_or_default_at_unchecked(0) - 1;
- auto end = params.number_or_default_at_unchecked(1) - 1;
- set_scrolling_region(start, end);
-}
-
-void
-VteTerminalPrivate::set_scrolling_region(vte::grid::row_t start /* relative */,
- vte::grid::row_t end /* relative */)
-{
- /* A (1-based) value of 0 means default. */
- if (start == -1) {
- start = 0;
- }
- if (end == -1) {
- end = m_row_count - 1;
- }
- /* Bail out on garbage, require at least 2 rows, as per xterm. */
- // FIXMEchpe
- if (start < 0 || start >= m_row_count - 1 || end < start + 1) {
- reset_scrolling_region();
- return;
- }
- if (end >= m_row_count) {
- end = m_row_count - 1;
- }
-
- /* Set the right values. */
- m_scrolling_region.start = start;
- m_scrolling_region.end = end;
- m_scrolling_restricted = TRUE;
- if (m_scrolling_region.start == 0 &&
- m_scrolling_region.end == m_row_count - 1) {
- /* Special case -- run wild, run free. */
- m_scrolling_restricted = FALSE;
- } else {
- /* Maybe extend the ring -- bug 710483 */
- while (_vte_ring_next(m_screen->row_data) < m_screen->insert_delta + m_row_count)
- _vte_ring_insert(m_screen->row_data, _vte_ring_next(m_screen->row_data));
- }
-
- home_cursor();
-}
-
/* Delete a character at the current cursor position. */
void
VteTerminalPrivate::delete_character()
@@ -1913,31 +1855,6 @@ VteTerminalPrivate::set_current_hyperlink(char *hyperlink_params /* adopted */,
g_free(uri);
}
-/* Restrict the scrolling region. */
-void
-VteTerminalPrivate::seq_set_scrolling_region_from_start(vte::parser::Params const& params)
-{
- /* We require a parameters. Anything less is a reset. */
- if (params.size() < 1)
- return reset_scrolling_region();
-
- auto end = params.number_or_default_at(1) - 1;
- set_scrolling_region(-1, end);
-
-}
-
-void
-VteTerminalPrivate::seq_set_scrolling_region_to_end(vte::parser::Params const& params)
-{
- /* We require a parameters. Anything less is a reset. */
- if (params.size() < 1)
- return reset_scrolling_region();
-
- auto start = params.number_or_default_at(0) - 1;
- set_scrolling_region(start, -1);
-
-}
-
void
VteTerminalPrivate::set_keypad_mode(VteKeymode mode)
{
@@ -4130,11 +4047,19 @@ VteTerminalPrivate::DECSTBM(vte::parser::Sequence const& seq)
{
/*
* DECSTBM - set-top-and-bottom-margins
+ * This control function sets the top and bottom margins for the current
+ * page. You cannot perform scrolling outside the margins.
+ *
+ * @args[0] defines the top margin, @args[1] defines the bottom margin.
+ * The bottom margin must be lower than the top-margin.
+ *
* This call resets the cursor position to (1,1).
*
* Defaults:
* args[0]: 1
- * args[1]: last page-line
+ * args[1]: number of lines in screen
+ *
+ * References: VT525 5–149
*/
#if 0
unsigned int top, bottom;
@@ -4164,7 +4089,43 @@ VteTerminalPrivate::DECSTBM(vte::parser::Sequence const& seq)
screen_cursor_set(screen, 0, 0);
#endif
- seq_set_scrolling_region(seq);
+ int start, end;
+ seq.collect(0, {&start, &end});
+
+ /* Defaults */
+ if (start == -1)
+ start = 1;
+ if (end == -1)
+ end = m_row_count;
+
+ /* Bail out on garbage, require at least 2 rows, as per xterm. */
+ // FIXMEchpe
+ if (start < 1 || start > m_row_count ||
+ end < (start + 1)) {
+ m_scrolling_restricted = FALSE;
+ home_cursor();
+ return;
+ }
+ // FIXMEchpe why not reset here too?
+ if (end > m_row_count) {
+ end = m_row_count;
+ }
+
+ /* Set the right values. */
+ m_scrolling_region.start = start - 1;
+ m_scrolling_region.end = end - 1;
+ m_scrolling_restricted = TRUE;
+ if (m_scrolling_region.start == 0 &&
+ m_scrolling_region.end == m_row_count - 1) {
+ /* Special case -- run wild, run free. */
+ m_scrolling_restricted = FALSE;
+ } else {
+ /* Maybe extend the ring -- bug 710483 */
+ while (_vte_ring_next(m_screen->row_data) < m_screen->insert_delta + m_row_count)
+ _vte_ring_insert(m_screen->row_data, _vte_ring_next(m_screen->row_data));
+ }
+
+ home_cursor();
}
void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]