diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2025-03-16 15:13:39 +0300 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2025-03-16 15:13:39 +0300 |
commit | 327d749ce03d25897447ec36ed4c46c0da4a72cb (patch) | |
tree | 198eeb70efeb62386a9735ee9a26230a16085f3b /src/interface-curses/curses-utils.h | |
parent | 24b08dac99804bed30824e9becb6f773d5db1874 (diff) | |
download | sciteco-327d749ce03d25897447ec36ed4c46c0da4a72cb.tar.gz |
further improved monochrome terminal support: fixed reverse text on reverse backgrounds
* Unfortunately we cannot use `wbkgdset(win, A_REVERSE)` if we plan to
use reverse text on this background, i.e. if we want to cancel out the background A_REVERSE.
* SciTECO therefore no longer uses background attributes, but only foreground attributes.
When setting a reverse text, we XOR A_REVERSE into the previous attributes.
* This fixes control characters especially in the info line and popups, as well as rendering
of the popup scroll bars.
* The command-line should now be rendered properly even on a dark-on-bright color theme
(which does not yet exist).
Diffstat (limited to 'src/interface-curses/curses-utils.h')
-rw-r--r-- | src/interface-curses/curses-utils.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/interface-curses/curses-utils.h b/src/interface-curses/curses-utils.h index 9f2e8f3..18cdd3d 100644 --- a/src/interface-curses/curses-utils.h +++ b/src/interface-curses/curses-utils.h @@ -34,3 +34,20 @@ teco_curses_add_wc(WINDOW *win, gunichar chr) gchar buf[6]; waddnstr(win, buf, g_unichar_to_utf8(chr, buf)); } + +/** + * Clear from the current position until the end of the given + * curses window with the current \b foreground attributes. + * This is similar to wclrtobot(), but does not use the + * background attributes. + */ +static inline void +teco_curses_clrtobot(WINDOW *win) +{ + int max_x, max_y; + getmaxyx(win, max_y, max_x); + if (getcurx(win)+1 < max_x) + whline(win, ' ', max_x - getcurx(win)); + for (int y = getcury(win)+1; y <= max_y; y++) + mvwhline(win, y, 0, ' ', max_x); +} |