[vte] emulation: Port DCH, ECH to new parameter glue
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vte] emulation: Port DCH, ECH to new parameter glue
- Date: Tue, 27 Mar 2018 17:43:03 +0000 (UTC)
commit b7262c35463bde2474f8a17defcec2b9cec0252d
Author: Christian Persch <chpe src gnome org>
Date: Tue Mar 27 19:40:12 2018 +0200
emulation: Port DCH, ECH to new parameter glue
src/vteseq-list.hh | 2 --
src/vteseq.cc | 39 ++++++++++++++++-----------------------
2 files changed, 16 insertions(+), 25 deletions(-)
---
diff --git a/src/vteseq-list.hh b/src/vteseq-list.hh
index 9d88f1a..5a7b223 100644
--- a/src/vteseq-list.hh
+++ b/src/vteseq-list.hh
@@ -36,7 +36,6 @@ SEQUENCE_HANDLER(cursor_lower_left)
SEQUENCE_HANDLER(dec_media_copy)
SEQUENCE_HANDLER(decreset)
SEQUENCE_HANDLER(decset)
-SEQUENCE_HANDLER(delete_characters)
SEQUENCE_HANDLER(delete_lines)
SEQUENCE_HANDLER(device_control_string)
SEQUENCE_HANDLER(double_height_bottom_half)
@@ -46,7 +45,6 @@ SEQUENCE_HANDLER(eight_bit_controls)
SEQUENCE_HANDLER(enable_filter_rectangle)
SEQUENCE_HANDLER(enable_locator_reporting)
SEQUENCE_HANDLER(end_of_guarded_area)
-SEQUENCE_HANDLER(erase_characters)
SEQUENCE_HANDLER(erase_in_display)
SEQUENCE_HANDLER(erase_in_line)
SEQUENCE_HANDLER(form_feed)
diff --git a/src/vteseq.cc b/src/vteseq.cc
index 00f5c45..90dc0dc 100644
--- a/src/vteseq.cc
+++ b/src/vteseq.cc
@@ -1262,17 +1262,6 @@ VteTerminalPrivate::delete_character()
m_text_deleted_flag = TRUE;
}
-/* Delete N characters at the current cursor position. */
-void
-VteTerminalPrivate::seq_delete_characters(vte::parser::Params const& params)
-{
- auto val = std::max(std::min(params.number_or_default_at(0, 1),
- int(m_column_count - m_screen->cursor.col)),
- int(1));
- for (auto i = 0; i < val; i++)
- delete_character();
-}
-
void
VteTerminalPrivate::move_cursor_down(vte::grid::row_t rows)
{
@@ -1292,16 +1281,6 @@ VteTerminalPrivate::move_cursor_down(vte::grid::row_t rows)
m_screen->cursor.row = MIN(m_screen->cursor.row + rows, end);
}
-/* Erase characters starting at the cursor position (overwriting N with
- * spaces, but not moving the cursor). */
-void
-VteTerminalPrivate::seq_erase_characters(vte::parser::Params const& params)
-{
- /* If we got a parameter, use it. */
- auto count = std::min(params.number_or_default_at(0, 1), int(65535));
- erase_characters(count);
-}
-
void
VteTerminalPrivate::erase_characters(long count)
{
@@ -3196,6 +3175,8 @@ VteTerminalPrivate::DCH(vte::parser::Sequence const& seq)
*
* Defaults:
* args[0]: 1
+ *
+ * References: ECMA-48 § 8.3.26
*/
#if 0
unsigned int num = 1;
@@ -3212,7 +3193,12 @@ VteTerminalPrivate::DCH(vte::parser::Sequence const& seq)
screen->age);
#endif
- seq_delete_characters(seq);
+ auto const value = seq.collect1(0, 1, 1, int(m_column_count - m_screen->cursor.col));
+
+ // FIXMEchpe pass count to delete_character() and simplify
+ // to only cleanup fragments once
+ for (auto i = 0; i < value; i++)
+ delete_character();
}
void
@@ -4494,6 +4480,8 @@ VteTerminalPrivate::ECH(vte::parser::Sequence const& seq)
*
* Defaults:
* args[0]: 1
+ *
+ * References: ECMA-48 § 8.3.38
*/
#if 0
unsigned int num = 1;
@@ -4507,7 +4495,12 @@ VteTerminalPrivate::ECH(vte::parser::Sequence const& seq)
&screen->state.attr, screen->age, false);
#endif
- seq_erase_characters(seq);
+ /* Erase characters starting at the cursor position (overwriting N with
+ * spaces, but not moving the cursor). */
+
+ // FIXMEchpe limit to column_count - cursor.x ?
+ auto const count = seq.collect1(0, 1, 1, int(65535));
+ erase_characters(count);
}
void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]