Revision: 4021 http://geany.svn.sourceforge.net/geany/?rev=4021&view=rev Author: eht16 Date: 2009-07-24 09:59:23 +0000 (Fri, 24 Jul 2009)
Log Message: ----------- Attempt to fix reshowing calltips after the autocompletion list has been shown.
Modified Paths: -------------- trunk/ChangeLog trunk/src/editor.c
Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2009-07-24 00:59:12 UTC (rev 4020) +++ trunk/ChangeLog 2009-07-24 09:59:23 UTC (rev 4021) @@ -1,3 +1,10 @@ +2009-07-24 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de> + + * src/editor.c: + Attempt to fix reshowing calltips after the autocompletion list + has been shown. + + 2009-07-23 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
* src/utils.c, src/utils.h, src/toolbar.c, src/plugindata.h,
Modified: trunk/src/editor.c =================================================================== --- trunk/src/editor.c 2009-07-24 00:59:12 UTC (rev 4020) +++ trunk/src/editor.c 2009-07-24 09:59:23 UTC (rev 4021) @@ -714,9 +714,17 @@ }
+typedef struct +{ + gint message; + gint pos; + gchar *text; +} CalltipReshowInfo; + + static gboolean reshow_calltip(gpointer data) { - SCNotification *nt = data; + CalltipReshowInfo *cri = data;
g_return_val_if_fail(calltip.sci != NULL, FALSE);
@@ -726,16 +734,19 @@ SSM(calltip.sci, SCI_CALLTIPSHOW, calltip.pos, (sptr_t) calltip.text);
/* now autocompletion has been cancelled by SCI_CALLTIPSHOW, so do it manually */ - if (nt->nmhdr.code == SCN_AUTOCSELECTION) + if (cri->message == SCN_AUTOCSELECTION) { gint pos = SSM(calltip.sci, SCI_GETCURRENTPOS, 0, 0);
- sci_set_selection_start(calltip.sci, nt->lParam); + sci_set_selection_start(calltip.sci, cri->pos); sci_set_selection_end(calltip.sci, pos); sci_replace_sel(calltip.sci, ""); /* clear root of word */ - SSM(calltip.sci, SCI_INSERTTEXT, nt->lParam, (sptr_t) nt->text); - sci_goto_pos(calltip.sci, nt->lParam + strlen(nt->text), FALSE); + SSM(calltip.sci, SCI_INSERTTEXT, cri->pos, (sptr_t) cri->text); + sci_goto_pos(calltip.sci, cri->pos + strlen(cri->text), FALSE); } + g_free(cri->text); + g_free(cri); + return FALSE; }
@@ -848,10 +859,13 @@ * if they were showing */ if (calltip.set) { + CalltipReshowInfo *cri = g_new0(CalltipReshowInfo, 1); + cri->message = nt->nmhdr.code; + cri->message = nt->lParam; + cri->text = g_strdup(nt->text); /* delay the reshow of the calltip window to make sure it is actually displayed, * without it might be not visible on SCN_AUTOCCANCEL */ - /* TODO g_idle_add() seems to be not enough, only with a timeout it works stable */ - g_timeout_add(50, reshow_calltip, nt); + g_idle_add(reshow_calltip, cri); } break; }
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.