From 48496b2eb5e1234476c590735e13c2f66e69248b Mon Sep 17 00:00:00 2001 From: Boris Faure Date: Sun, 24 Feb 2019 17:06:31 +0100 Subject: [PATCH] termpty: cell is empty if bg is invisible. Closes T7707 --- src/bin/termpty.c | 11 ++++------- tests/cell_is_empty.sh | 30 ++++++++++++++++++++++++++++++ tests/tests.results | 1 + 3 files changed, 35 insertions(+), 7 deletions(-) create mode 100755 tests/cell_is_empty.sh diff --git a/src/bin/termpty.c b/src/bin/termpty.c index 295fd698..a1108060 100644 --- a/src/bin/termpty.c +++ b/src/bin/termpty.c @@ -848,13 +848,10 @@ termpty_free(Termpty *ty) static Eina_Bool _termpty_cell_is_empty(const Termcell *cell) { - if ((cell->codepoint != 0) && - (!cell->att.invisible) && - (cell->att.fg != COL_INVIS)) - { - return EINA_FALSE; - } - return EINA_TRUE; + return (((cell->codepoint == 0) || + (cell->att.invisible) || + (cell->att.fg == COL_INVIS)) && + (cell->att.bg == COL_INVIS)); } static Eina_Bool diff --git a/tests/cell_is_empty.sh b/tests/cell_is_empty.sh new file mode 100755 index 00000000..3a2cf66b --- /dev/null +++ b/tests/cell_is_empty.sh @@ -0,0 +1,30 @@ +#!/bin/sh + +# char width: 7 +# char height: 15 + +# clear screen +printf '\033[2J' + +# set color +printf '\033[46;31;3m' + +#move to 8;8 +printf '\033[8;8H#' +#move to 8;40 +printf '\033[8;40H#' +#switch to altbuf +printf '\033[?1049h' + +# change colors +printf '\033[m\033[37m\033[40m' +# move to 0;0 +printf '\033[H' +# clear screen +printf '\033[2J' +# change colors +printf '\033[37m\033[40m\033[97m\033[40m' +# move +printf '\033[3;2H' +# text +printf '**\o/**' diff --git a/tests/tests.results b/tests/tests.results index f5b8659a..f2ece93b 100644 --- a/tests/tests.results +++ b/tests/tests.results @@ -77,6 +77,7 @@ uts.sh 075ff9f8c4f718784330bac4fcae932b vpa.sh 4614f3c337e9d47fed3a4233df719617 decswbv.sh f90ffe93b1bd99c6b7385ca71c6793de c2.sh 9f264ee84b6d89f1f9fa7b76abd442c0 +cell_is_empty.sh 507bc5dca92d6f0d4c081a5146c13ed6 selection_simple.sh 1b3a915bf40ba8e869021055d368edf2 selection_box_simple.sh 1b3a915bf40ba8e869021055d368edf2 selection_all_directions.sh ad1c5bf43f0ec9a921616c3da10cab7f