Skip to content

Commit 67e828f

Browse files
Stanislav SpassovCarlos Cabanero
Stanislav Spassov
authored and
Carlos Cabanero
committed
Add support for ECMA-48 escape sequence for crossed-out/strikethrough
ECMA-48 defines rendition mode 9 as: crossed-out (characters still legible but marked as to be deleted), and mode 29 as the inverse: not crossed out Modern terminals (including xterm, tmux, libvte, etc.) support rendering strikethrough. Further, ncurses since version 6.1 includes the smxx/rmxx user-defined terminal capabilities in the tmux and xterm-basic databases. Note that the new attribute still fits in the eight bits allocated for Renditions::attributes, so there is no need to increase the size of Cell. Signed-off-by: Stanislav Spassov <[email protected]>
1 parent 8226bbf commit 67e828f

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

src/terminal/terminalframebuffer.cc

+7-1
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ void Renditions::set_rendition( color_type num )
479479
return;
480480
}
481481

482-
bool value = num < 9;
482+
bool value = num < 10;
483483
switch ( num ) {
484484
case 1:
485485
set_attribute( bold, value );
@@ -511,6 +511,10 @@ void Renditions::set_rendition( color_type num )
511511
case 28:
512512
set_attribute( invisible, value );
513513
break;
514+
case 9:
515+
case 29:
516+
set_attribute (strikethrough, value);
517+
break;
514518
default:
515519
break; /* ignore unknown rendition */
516520
}
@@ -554,6 +558,8 @@ std::string Renditions::sgr( void ) const
554558
ret.append( ";7" );
555559
if ( get_attribute( invisible ) )
556560
ret.append( ";8" );
561+
if ( get_attribute( strikethrough ) )
562+
ret.append( ";9" );
557563

558564
if ( foreground_color ) {
559565
// Since foreground_color is a 25-bit field, it is promoted to an int when

src/terminal/terminalframebuffer.h

+1
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ class Renditions
5959
blink,
6060
inverse,
6161
invisible,
62+
strikethrough,
6263
SIZE
6364
} attribute_type;
6465

src/tests/emulation-attributes.test

+2
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,8 @@ baseline()
130130
test_true_color 7
131131
echo "Invisible:"
132132
test_true_color 8
133+
echo "Strikethrough:"
134+
test_true_color 9
133135
echo "Bold, italic and underline:"
134136
test_true_color 1 3 4
135137
;;

0 commit comments

Comments
 (0)