[pushed,gdb/tui] Fix buglet in tui_update_variables
Commit Message
[ was: Re: [PATCH 2/3] [gdb/tui] Fix buglet in set_border_kind_item ]
On 5/8/23 16:10, Tom de Vries via Gdb-patches wrote:
> While factoring out set_border_kind_item I noticed a buglet:
> ...
> struct tui_translate *entry = translate (key, dict);
>
> if (*lval != (chtype) entry->value)
> {
> *lval = (entry->value < 0) ? acs : entry->value;
> ...
>
> When assigning the new value to *lval, an entry->value of -1 is taken into
> account, but not when comparing to the current value of *lval.
>
> Fix this by introducing:
> ...
> int val = (entry->value < 0) ? acs : entry->value;
> ...
> and using this in both comparison and assignment.
>
I'm not sure if the enhancement "border-kind active-ascii" will make it,
so I've ported this fix to trunk and committed.
Thanks,
- Tom
From cd1ed1fd2e8ccec34008d03a9b25132f4eb3bf64 Mon Sep 17 00:00:00 2001
From: Tom de Vries <tdevries@suse.de>
Date: Mon, 8 May 2023 13:24:08 +0200
Subject: [pushed] [gdb/tui] Fix buglet in tui_update_variables
I noticed a buglet in tui_update_variables:
...
entry = translate (tui_border_kind, tui_border_kind_translate_lrcorner);
if (tui_border_lrcorner != (chtype) entry->value)
{
tui_border_lrcorner = (entry->value < 0) ? ACS_LRCORNER : entry->value;
...
When assigning the new value to tui_border_lrcorner, an entry->value of -1 is
taken into account, but not when comparing to the current value of
tui_border_lrcorner.
Fix this by introducing:
...
int val = (entry->value < 0) ? ACS_LRCORNER : entry->value;
...
and using this in both comparison and assignment.
Tested on x86_64-linux.
---
gdb/tui/tui-win.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
@@ -300,9 +300,10 @@ tui_update_variables ()
Only check the first one. The ACS characters are determined at
run time by curses terminal management. */
entry = translate (tui_border_kind, tui_border_kind_translate_lrcorner);
- if (tui_border_lrcorner != (chtype) entry->value)
+ int val = (entry->value < 0) ? ACS_LRCORNER : entry->value;
+ if (tui_border_lrcorner != (chtype) val)
{
- tui_border_lrcorner = (entry->value < 0) ? ACS_LRCORNER : entry->value;
+ tui_border_lrcorner = val;
need_redraw = true;
}
entry = translate (tui_border_kind, tui_border_kind_translate_llcorner);
base-commit: 7a8a6f57eced9a8c27a93cb5c5977a33be7b1f72
--
2.35.3