[PATCH] Fix regression in color range check
Sebastian Thorarensen
sebth at naju.se
Sat May 23 19:18:37 CEST 2026
The change to add 24-bit direct color support caused color indexes out
of range to become black instead of the default color.
---
src/command.C | 2 +-
src/rxvt.h | 2 +-
src/screen.C | 4 ++--
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/command.C b/src/command.C
index 891ffab..899d926 100644
--- a/src/command.C
+++ b/src/command.C
@@ -4080,7 +4080,7 @@ rxvt_term::process_sgr_mode (unsigned int nargs, const int *arg)
i += 4;
- scr_color (idx, fgbg);
+ scr_color (idx, fgbg, maxTermCOLOR24);
}
}
break;
diff --git a/src/rxvt.h b/src/rxvt.h
index 37aba23..c1ef631 100644
--- a/src/rxvt.h
+++ b/src/rxvt.h
@@ -1493,7 +1493,7 @@ struct rxvt_term : zero_initialized, rxvt_vars, rxvt_screen
void scr_do_wrap () noexcept;
void scr_swap_screen () noexcept;
void scr_change_screen (int scrn);
- void scr_color (unsigned int color, int fgbg) noexcept;
+ void scr_color (unsigned int color, int fgbg, unsigned int maxcolor = maxTermCOLOR) noexcept;
void scr_rendition (int set, int style) noexcept;
void scr_add_lines (const wchar_t *str, int len, int minlines = 0) noexcept;
void scr_backspace () noexcept;
diff --git a/src/screen.C b/src/screen.C
index 8fdfad9..fcff463 100644
--- a/src/screen.C
+++ b/src/screen.C
@@ -616,9 +616,9 @@ rxvt_term::scr_do_wrap () noexcept
* Change the colour for following text
*/
void
-rxvt_term::scr_color (unsigned int color, int fgbg) noexcept
+rxvt_term::scr_color (unsigned int color, int fgbg, unsigned int maxcolor) noexcept
{
- if (!IN_RANGE_INC (color, minCOLOR, maxTermCOLOR24))
+ if (!IN_RANGE_INC (color, minCOLOR, maxcolor))
color = fgbg;
if (fgbg == Color_fg)
--
2.30.2
More information about the rxvt-unicode
mailing list