From 70b0db4aa5acf071dd6a7adfd2b25e92511745db Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Wed, 17 Oct 2012 13:11:23 +0200 Subject: [PATCH] Add highlighting in move list For now it is assumed the normal background will be white (for clearing the highlight). --- xhistory.c | 16 ++++++++++++---- 1 files changed, 12 insertions(+), 4 deletions(-) diff --git a/xhistory.c b/xhistory.c index 0ac764f..fb5639c 100644 --- a/xhistory.c +++ b/xhistory.c @@ -24,6 +24,7 @@ #include #include +#include #include "common.h" #include "backend.h" @@ -50,10 +51,17 @@ extern Option historyOptions[]; void HighlightMove (int from, int to, Boolean highlight) { -#ifdef TODO_GTK - if(highlight) - XawTextSetSelection( historyOptions[0].handle, from, to ); // for lack of a better method, use selection for highighting -#endif + static int init = 0; + GtkTextIter start, end; + + if(!init) { + init = 1; + gtk_text_buffer_create_tag(historyOptions[0].handle, "highlight", "background", "yellow", NULL); + gtk_text_buffer_create_tag(historyOptions[0].handle, "normal", "background", "white", NULL); + } + gtk_text_buffer_get_iter_at_offset(historyOptions[0].handle, &start, from); + gtk_text_buffer_get_iter_at_offset(historyOptions[0].handle, &end, to); + gtk_text_buffer_apply_tag_by_name(historyOptions[0].handle, highlight ? "highlight" : "normal", &start, &end); } void -- 1.7.0.4