Implement ECMA-48 "REP", some Linuxen have started emitting them recently.

Approved by:	ed
This commit is contained in:
Poul-Henning Kamp 2018-10-21 08:29:36 +00:00
parent 60874184a0
commit 3eb27bf0a7
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=339529
4 changed files with 16 additions and 1 deletions

View File

@ -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 "}";

View File

@ -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

View File

@ -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;

View File

@ -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);
}