From bb8ac1cded24663605c050168502aa3b8c056e50 Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Sat, 9 Mar 2024 18:44:27 +0200 Subject: [PATCH] Curses: message window unhilite The curses message window shows new messages bold, and removes the bolding from older ones. The code was calling curses mvwchgat with attribute and color parameters in the wrong order. Also change the code to actually retain the color of the window, so it just removes the bold attribute. --- win/curses/cursmesg.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/win/curses/cursmesg.c b/win/curses/cursmesg.c index 14e87bebd..3cf16af09 100644 --- a/win/curses/cursmesg.c +++ b/win/curses/cursmesg.c @@ -374,7 +374,7 @@ curses_more(void) void curses_clear_unhighlight_message_window(void) { - int mh, mw, count, + int mh, mw, rx, ry, brdroffset = curses_window_has_border(MESSAGE_WIN) ? 1 : 0; WINDOW *win = curses_get_nhwin(MESSAGE_WIN); @@ -387,9 +387,15 @@ curses_clear_unhighlight_message_window(void) } else { mx = mw + brdroffset; /* Force new line on new turn */ - for (count = 0; count < mh; count++) - mvwchgat(win, count + brdroffset, brdroffset, - mw, COLOR_PAIR(8), A_NORMAL, NULL); + for (ry = brdroffset; ry < mh; ry++) { + for (rx = brdroffset; rx < mw; rx++) { + chtype cht = mvwinch(win, ry, rx); + short clr = cht & A_COLOR; + + mvwchgat(win, ry, rx, 1, A_NORMAL, PAIR_NUMBER(clr), NULL); + } + } + wnoutrefresh(win); } wmove(win, my, mx);