[vte] emulation: Port REP to new parameter glue
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vte] emulation: Port REP to new parameter glue
- Date: Tue, 27 Mar 2018 17:43:13 +0000 (UTC)
commit 8a1b704d84a3b97842238d417641fa288a78b453
Author: Christian Persch <chpe src gnome org>
Date: Tue Mar 27 19:40:12 2018 +0200
emulation: Port REP to new parameter glue
src/vteseq-list.hh | 1 -
src/vteseq.cc | 25 ++++++++++---------------
2 files changed, 10 insertions(+), 16 deletions(-)
---
diff --git a/src/vteseq-list.hh b/src/vteseq-list.hh
index 1013d22..944e6de 100644
--- a/src/vteseq-list.hh
+++ b/src/vteseq-list.hh
@@ -67,7 +67,6 @@ SEQUENCE_HANDLER(memory_unlock)
SEQUENCE_HANDLER(next_line)
SEQUENCE_HANDLER(nop)
SEQUENCE_HANDLER(normal_keypad)
-SEQUENCE_HANDLER(repeat)
SEQUENCE_HANDLER(request_locator_position)
SEQUENCE_HANDLER(request_terminal_parameters)
SEQUENCE_HANDLER(reset_background_color)
diff --git a/src/vteseq.cc b/src/vteseq.cc
index 8f08da5..b314cfb 100644
--- a/src/vteseq.cc
+++ b/src/vteseq.cc
@@ -1338,20 +1338,6 @@ VteTerminalPrivate::insert_blank_character()
m_screen->cursor = save;
}
-/* REP: Repeat the last graphic character n times. */
-void
-VteTerminalPrivate::seq_repeat(vte::parser::Params const& params)
-{
- auto val = std::min(params.number_or_default_at(0, 1),
- int(65535)); // FIXMEchpe maybe limit more, to m_column_count -
m_screen->cursor.col ?
- for (auto i = 0; i < val; i++) {
- // FIXMEchpe can't we move that check out of the loop?
- if (m_last_graphic_character == 0)
- break;
- insert_char(m_last_graphic_character, false, true);
- }
-}
-
/* Cursor down 1 line, with scrolling. */
void
VteTerminalPrivate::seq_index(vte::parser::Params const& params)
@@ -5046,9 +5032,18 @@ VteTerminalPrivate::REP(vte::parser::Sequence const& seq)
*
* Defaults:
* args[0]: 1
+ *
+ * References: ECMA-48 ยง 8.3.103
*/
- seq_repeat(seq);
+ if (m_last_graphic_character == 0)
+ return;
+
+ auto const count = seq.collect1(0, 1, 1, int(m_column_count - m_screen->cursor.col));
+
+ // FIXMEchpe insert in one run so we only clean up fragments once
+ for (auto i = 0; i < count; i++)
+ insert_char(m_last_graphic_character, false, true);
}
void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]