SF.net SVN: geany:[4022] trunk

eht16 at users.sourceforge.net eht16 at xxxxx
Fri Jul 24 10:40:48 UTC 2009


Revision: 4022
          http://geany.svn.sourceforge.net/geany/?rev=4022&view=rev
Author:   eht16
Date:     2009-07-24 10:40:48 +0000 (Fri, 24 Jul 2009)

Log Message:
-----------
Reshow calltips also when the autocompletion list was closed implicitly by not choosing an item.

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/src/editor.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2009-07-24 09:59:23 UTC (rev 4021)
+++ trunk/ChangeLog	2009-07-24 10:40:48 UTC (rev 4022)
@@ -3,6 +3,8 @@
  * src/editor.c:
    Attempt to fix reshowing calltips after the autocompletion list
    has been shown.
+   Reshow calltips also when the autocompletion list was closed
+   implicitly by not choosing an item.
 
 
 2009-07-23  Nick Treleaven  <nick(dot)treleaven(at)btinternet(dot)com>

Modified: trunk/src/editor.c
===================================================================
--- trunk/src/editor.c	2009-07-24 09:59:23 UTC (rev 4021)
+++ trunk/src/editor.c	2009-07-24 10:40:48 UTC (rev 4022)
@@ -490,6 +490,57 @@
 }
 
 
+typedef struct
+{
+	gint message;
+	gint pos;
+	gchar *text;
+} CalltipReshowInfo;
+
+
+static gboolean reshow_calltip(gpointer data)
+{
+	CalltipReshowInfo *cri = data;
+
+	g_return_val_if_fail(calltip.sci != NULL, FALSE);
+
+	SSM(calltip.sci, SCI_CALLTIPCANCEL, 0, 0);
+	/* 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 */
+	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 */
+		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;
+}
+
+
+static void request_reshowing_calltip(SCNotification *nt)
+{
+	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 */
+		g_idle_add(reshow_calltip, cri);
+	}
+}
+
 static void autocomplete_scope(GeanyEditor *editor)
 {
 	ScintillaObject *sci = editor->sci;
@@ -601,7 +652,8 @@
 		case ':':	/* C/C++ class:: syntax */
 		/* tag autocompletion */
 		default:
-			editor_start_auto_complete(editor, pos, FALSE);
+			if (! editor_start_auto_complete(editor, pos, FALSE))
+				request_reshowing_calltip(nt);
 	}
 	check_line_breaking(editor, pos, nt->ch);
 }
@@ -714,43 +766,6 @@
 }
 
 
-typedef struct
-{
-	gint message;
-	gint pos;
-	gchar *text;
-} CalltipReshowInfo;
-
-
-static gboolean reshow_calltip(gpointer data)
-{
-	CalltipReshowInfo *cri = data;
-
-	g_return_val_if_fail(calltip.sci != NULL, FALSE);
-
-	SSM(calltip.sci, SCI_CALLTIPCANCEL, 0, 0);
-	/* 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 */
-	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 */
-		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;
-}
-
-
 static void auto_update_margin_width(GeanyEditor *editor)
 {
 	gint next_linecount = 1;
@@ -857,16 +872,7 @@
 		{
 			/* now that autocomplete is finishing or was cancelled, reshow calltips
 			 * 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 */
-				g_idle_add(reshow_calltip, cri);
-			}
+			request_reshowing_calltip(nt);
 			break;
 		}
 #ifdef GEANY_DEBUG


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the Commits mailing list