From 64b126fabffe2a06abe02181b210c66e63985217 Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Sat, 25 Sep 2010 19:49:46 +0400 Subject: [PATCH 1/2] Ticket #2362: width of WCheck and WRadio widgets are initialized incorrectly. Signed-off-by: Andrew Borodin --- src/widget.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/widget.c b/src/widget.c index 704062b30..f900b65d6 100644 --- a/src/widget.c +++ b/src/widget.c @@ -520,7 +520,8 @@ radio_new (int y, int x, int count, const char **texts) max = m; } - init_widget (&result->widget, y, x, count, max, radio_callback, radio_event); + init_widget (&result->widget, y, x, count, 4 + max, radio_callback, radio_event); + /* 4 is width of "(*) " */ result->state = 1; result->pos = 0; result->sel = 0; @@ -615,7 +616,8 @@ check_new (int y, int x, int state, const char *text) c->text = parse_hotkey (text); - init_widget (&c->widget, y, x, 1, hotkey_width (c->text), check_callback, check_event); + init_widget (&c->widget, y, x, 1, 4 + hotkey_width (c->text), check_callback, check_event); + /* 4 is width of "[X] " */ c->state = state ? C_BOOL : 0; widget_want_hotkey (c->widget, 1); From 329f473d329c56f429bc702743482576b1634b0b Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Sat, 25 Sep 2010 20:14:26 +0400 Subject: [PATCH 2/2] Highlight selected item of WRadio using widget width not item width. Signed-off-by: Andrew Borodin --- src/widget.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/widget.c b/src/widget.c index f900b65d6..0a868d727 100644 --- a/src/widget.c +++ b/src/widget.c @@ -461,6 +461,7 @@ radio_callback (Widget * w, widget_msg_t msg, int parm) const gboolean focused = (i == r->pos && msg == WIDGET_FOCUS); widget_selectcolor (w, focused, FALSE); widget_move (&r->widget, i, 0); + tty_draw_hline (r->widget.y + i, r->widget.x, ' ', r->widget.cols); tty_print_string ((r->sel == i) ? "(*) " : "( ) "); draw_hotkey (w, r->texts[i], focused); }