diff --git a/gui_frame.c b/gui_frame.c index cd98e37..74cfb03 100644 --- a/gui_frame.c +++ b/gui_frame.c @@ -508,8 +508,19 @@ static void unselect_value(void *data) { struct value *value = data; + /* + * This condition is a little cryptic. Here is what it does: + * + * IF table/assignment (not loop) + * AND the current row is the active (selected) row + * AND it's an assignment (not a table). + * + * We need the last condition because the expressions of assignments + * are drawn with COLOR_VAR_PASSIVE. (See build_assignment.) + */ label_in_box_bg(value->widget, - value->row && value->row->table->active_row == value->row ? + value->row && value->row->table->active_row == value->row && + value->row->table->rows->next ? COLOR_CHOICE_SELECTED : COLOR_EXPR_PASSIVE); } @@ -620,6 +631,12 @@ static gboolean assignment_value_select_event(GtkWidget *widget, } +/* + * In tables, expressions in the active row have a COLOR_CHOICE_SELECTED + * background. While expressions in assignments are technically on the active + * (and only) row, we use COLOR_VAR_PASSIVE for better readability. + */ + static void build_assignment(GtkWidget *vbox, struct frame *frame, struct table *table) { diff --git a/gui_style.h b/gui_style.h index 40ca9ff..9481dcf 100644 --- a/gui_style.h +++ b/gui_style.h @@ -83,7 +83,7 @@ #define COLOR_EXPR_PASSIVE "#f0f0ff" #define COLOR_EXPR_EDITING COLOR_EDITING #define COLOR_CHOICE_UNSELECTED COLOR_EXPR_PASSIVE -#define COLOR_CHOICE_SELECTED "#9090ff" +#define COLOR_CHOICE_SELECTED "#a0a0ff" #define COLOR_ROW_UNSELECTED COLOR_CHOICE_UNSELECTED #define COLOR_ROW_SELECTED COLOR_CHOICE_SELECTED diff --git a/obj.h b/obj.h index bcd72be..8774295 100644 --- a/obj.h +++ b/obj.h @@ -42,7 +42,7 @@ struct value { struct expr *expr; struct value *next; - /* back reference */ + /* back reference, NULL if loop */ struct row *row; /* for the GUI */