[vte/vte-0-46] emulation: Add support for REP (repeat preceding graphic character)
- From: Egmont Koblinger <egmontkob src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vte/vte-0-46] emulation: Add support for REP (repeat preceding graphic character)
- Date: Wed, 4 Oct 2017 20:35:10 +0000 (UTC)
commit e81ecf7408a943566196d03b605a05a197381068
Author: Egmont Koblinger <egmont gmail com>
Date: Thu Sep 28 16:03:04 2017 +0200
emulation: Add support for REP (repeat preceding graphic character)
https://bugzilla.gnome.org/show_bug.cgi?id=787701
(cherry picked from commit 0656a5794c8d075c8e7c4b56b3b6142068433981)
src/vte.cc | 6 ++++++
src/vteinternal.hh | 1 +
src/vteseq-n.gperf | 2 +-
src/vteseq.cc | 18 ++++++++++++++++++
4 files changed, 26 insertions(+), 1 deletions(-)
---
diff --git a/src/vte.cc b/src/vte.cc
index ea41588..536cec2 100644
--- a/src/vte.cc
+++ b/src/vte.cc
@@ -2897,6 +2897,7 @@ VteTerminalPrivate::insert_char(gunichar c,
long col;
int columns, i;
bool line_wrapped = false; /* cursor moved before char inserted */
+ gunichar c_unmapped = c;
/* DEC Special Character and Line Drawing Set. VT100 and higher (per XTerm docs). */
static gunichar line_drawing_map[31] = {
@@ -3043,6 +3044,8 @@ VteTerminalPrivate::insert_char(gunichar c,
row_num, 1);
goto done;
+ } else {
+ m_last_graphic_character = c_unmapped;
}
/* Make sure we have enough rows to hold this data. */
@@ -3574,6 +3577,7 @@ skip_chunk:
/* Call the right sequence handler for the requested
* behavior. */
handle_sequence(seq_match, params);
+ m_last_graphic_character = 0;
/* Skip over the proper number of unicode chars. */
start = (next - wbuf);
@@ -7808,6 +7812,7 @@ VteTerminalPrivate::VteTerminalPrivate(VteTerminal *t) :
m_conv_buffer = _vte_byte_array_new();
set_encoding(nullptr /* UTF-8 */);
g_assert_cmpstr(m_encoding, ==, "UTF-8");
+ m_last_graphic_character = 0;
/* Set up the emulation. */
m_keypad_mode = VTE_KEYMODE_NORMAL;
@@ -9993,6 +9998,7 @@ VteTerminalPrivate::reset(bool clear_tabstops,
m_iso2022 = _vte_iso2022_state_new(nullptr);
_vte_iso2022_state_set_codeset(m_iso2022,
m_encoding);
+ m_last_graphic_character = 0;
/* Reset keypad/cursor key modes. */
m_keypad_mode = VTE_KEYMODE_NORMAL;
m_cursor_mode = VTE_KEYMODE_NORMAL;
diff --git a/src/vteinternal.hh b/src/vteinternal.hh
index cff2157..4c6a240 100644
--- a/src/vteinternal.hh
+++ b/src/vteinternal.hh
@@ -294,6 +294,7 @@ public:
struct _vte_iso2022_state *m_iso2022;
_vte_incoming_chunk_t *m_incoming; /* pending bytestream */
GArray *m_pending; /* pending characters */
+ gunichar m_last_graphic_character; /* for REP */
/* Array of dirty rectangles in view coordinates; need to
* add allocation origin and padding when passing to gtk.
*/
diff --git a/src/vteseq-n.gperf b/src/vteseq-n.gperf
index eec89ae..7cd1de5 100644
--- a/src/vteseq-n.gperf
+++ b/src/vteseq-n.gperf
@@ -28,7 +28,7 @@ struct vteseq_n_struct {
"tab", VTE_SEQUENCE_HANDLER(vte_sequence_handler_tab)
"index", VTE_SEQUENCE_HANDLER(vte_sequence_handler_index)
"decset", VTE_SEQUENCE_HANDLER(vte_sequence_handler_decset)
-#"repeat", VTE_SEQUENCE_HANDLER_NULL
+"repeat", VTE_SEQUENCE_HANDLER(vte_sequence_handler_repeat)
"tab-set", VTE_SEQUENCE_HANDLER(vte_sequence_handler_tab_set)
"decreset", VTE_SEQUENCE_HANDLER(vte_sequence_handler_decreset)
"set-mode", VTE_SEQUENCE_HANDLER(vte_sequence_handler_set_mode)
diff --git a/src/vteseq.cc b/src/vteseq.cc
index 4dab1de..a65c83c 100644
--- a/src/vteseq.cc
+++ b/src/vteseq.cc
@@ -1572,6 +1572,24 @@ vte_sequence_handler_insert_blank_characters (VteTerminalPrivate *that, GValueAr
vte_sequence_handler_multiple_r(that, params, _vte_sequence_handler_insert_character);
}
+/* Repeat the last graphic character once. */
+static void
+vte_sequence_handler_repeat_internal (VteTerminalPrivate *that, GValueArray *params)
+{
+ if (that->m_last_graphic_character != 0)
+ that->insert_char (that->m_last_graphic_character, false, true);
+}
+
+/* REP: Repeat the last graphic character n times. */
+static void
+vte_sequence_handler_repeat (VteTerminalPrivate *that, GValueArray *params)
+{
+ vte_sequence_handler_multiple_limited (that,
+ params,
+ vte_sequence_handler_repeat_internal,
+ 65535);
+}
+
/* Cursor down 1 line, with scrolling. */
static void
vte_sequence_handler_index (VteTerminalPrivate *that, GValueArray *params)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]