[vte/vte-0-48] 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-48] emulation: Add support for REP (repeat preceding graphic character)
- Date: Thu, 28 Sep 2017 14:06:17 +0000 (UTC)
commit d854bc3b98018854dfdfbf54532e2deb5b662689
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 c56c7da..e154d72 100644
--- a/src/vte.cc
+++ b/src/vte.cc
@@ -2899,6 +2899,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] = {
@@ -3045,6 +3046,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. */
@@ -3587,6 +3590,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);
@@ -7821,6 +7825,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;
@@ -10004,6 +10009,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 a20e89f..2939b0c 100644
--- a/src/vteinternal.hh
+++ b/src/vteinternal.hh
@@ -295,6 +295,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 5f8a618..45fdcc2 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]