Remove unnecessary CalltipReshowInfo struct - as the calltip reshowing is delayed, autocompletion has already worked normally.
git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@4317 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
parent
49a8d9dc0b
commit
7b18977916
30
src/editor.c
30
src/editor.c
@ -488,17 +488,8 @@ static gboolean match_last_chars(ScintillaObject *sci, gint pos, const gchar *st
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
gint message;
|
|
||||||
gint pos;
|
|
||||||
gchar *text;
|
|
||||||
} CalltipReshowInfo;
|
|
||||||
|
|
||||||
|
|
||||||
static gboolean reshow_calltip(gpointer data)
|
static gboolean reshow_calltip(gpointer data)
|
||||||
{
|
{
|
||||||
CalltipReshowInfo *cri = data;
|
|
||||||
GeanyDocument *doc;
|
GeanyDocument *doc;
|
||||||
|
|
||||||
g_return_val_if_fail(calltip.sci != NULL, FALSE);
|
g_return_val_if_fail(calltip.sci != NULL, FALSE);
|
||||||
@ -511,22 +502,7 @@ static gboolean reshow_calltip(gpointer data)
|
|||||||
/* we use the position where the calltip was previously started as SCI_GETCURRENTPOS
|
/* we use the position where the calltip was previously started as SCI_GETCURRENTPOS
|
||||||
* may be completely wrong in case the user cancelled the auto completion with the mouse */
|
* may be completely wrong in case the user cancelled the auto completion with the mouse */
|
||||||
SSM(calltip.sci, SCI_CALLTIPSHOW, calltip.pos, (sptr_t) calltip.text);
|
SSM(calltip.sci, SCI_CALLTIPSHOW, calltip.pos, (sptr_t) calltip.text);
|
||||||
|
|
||||||
/* now autocompletion has been cancelled by SCI_CALLTIPSHOW, so do it manually */
|
|
||||||
if (cri->message == SCN_AUTOCSELECTION)
|
|
||||||
{
|
|
||||||
gint pos = SSM(calltip.sci, SCI_GETCURRENTPOS, 0, 0);
|
|
||||||
|
|
||||||
sci_set_selection_start(calltip.sci, cri->pos);
|
|
||||||
sci_set_selection_end(calltip.sci, pos);
|
|
||||||
sci_replace_sel(calltip.sci, ""); /* clear root of word */
|
|
||||||
sci_insert_text(calltip.sci, cri->pos, cri->text);
|
|
||||||
sci_goto_pos(calltip.sci, cri->pos + strlen(cri->text), FALSE);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
g_free(cri->text);
|
|
||||||
g_free(cri);
|
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -535,13 +511,9 @@ static void request_reshowing_calltip(SCNotification *nt)
|
|||||||
{
|
{
|
||||||
if (calltip.set)
|
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,
|
/* delay the reshow of the calltip window to make sure it is actually displayed,
|
||||||
* without it might be not visible on SCN_AUTOCCANCEL */
|
* without it might be not visible on SCN_AUTOCCANCEL */
|
||||||
g_idle_add(reshow_calltip, cri);
|
g_idle_add(reshow_calltip, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user