From 3eb27bf0a7b229d523bcc059b90784cfd7b908db Mon Sep 17 00:00:00 2001 From: Poul-Henning Kamp Date: Sun, 21 Oct 2018 08:29:36 +0000 Subject: [PATCH] Implement ECMA-48 "REP", some Linuxen have started emitting them recently. Approved by: ed --- sys/teken/gensequences | 1 + sys/teken/sequences | 3 +++ sys/teken/teken.h | 1 + sys/teken/teken_subr.h | 12 +++++++++++- 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/sys/teken/gensequences b/sys/teken/gensequences index a18e7a12fe0..49cd771ed06 100644 --- a/sys/teken/gensequences +++ b/sys/teken/gensequences @@ -158,6 +158,7 @@ for (p in l_prefix_name) { if (l_prefix_name[p] != "teken_state_init") { print ""; + print "\tt->t_last = 0;"; print "\tteken_state_switch(t, teken_state_init);"; } print "}"; diff --git a/sys/teken/sequences b/sys/teken/sequences index 0224584bea2..921dcce5669 100644 --- a/sys/teken/sequences +++ b/sys/teken/sequences @@ -114,3 +114,6 @@ C25VTSW Cons25 switch virtual terminal ^[ [ z r # VT52 compatibility #DECID VT52 DECID ^[ Z + +# ECMA-48 +REP Repeat last graphic char ^[ [ b n diff --git a/sys/teken/teken.h b/sys/teken/teken.h index 0186fedb20d..5ee2474ed45 100644 --- a/sys/teken/teken.h +++ b/sys/teken/teken.h @@ -157,6 +157,7 @@ struct __teken { unsigned int t_utf8_left; teken_char_t t_utf8_partial; + teken_char_t t_last; unsigned int t_curscs; teken_scs_t *t_saved_curscs; diff --git a/sys/teken/teken_subr.h b/sys/teken/teken_subr.h index c69fe76bfb1..c9dfa4d9bb9 100644 --- a/sys/teken/teken_subr.h +++ b/sys/teken/teken_subr.h @@ -796,10 +796,11 @@ teken_subr_primary_device_attributes(const teken_t *t, unsigned int request) } static void -teken_subr_do_putchar(const teken_t *t, const teken_pos_t *tp, teken_char_t c, +teken_subr_do_putchar(teken_t *t, const teken_pos_t *tp, teken_char_t c, int width) { + t->t_last = c; if (t->t_stateflags & TS_INSERT && tp->tp_col < t->t_winsize.tp_col - width) { teken_rect_t ctr; @@ -1332,3 +1333,12 @@ teken_subr_vertical_position_absolute(teken_t *t, unsigned int row) t->t_stateflags &= ~TS_WRAPPED; teken_funcs_cursor(t); } + +static void +teken_subr_repeat_last_graphic_char(teken_t *t, unsigned int rpts) +{ + + for (; t->t_last != 0 && rpts > 0; rpts--) + teken_subr_regular_character(t, t->t_last); +} +