SF.net SVN: geany: [562] trunk

eht16 at users.sourceforge.net eht16 at xxxxx
Sat Jul 15 12:38:54 UTC 2006


Revision: 562
Author:   eht16
Date:     2006-07-15 05:38:45 -0700 (Sat, 15 Jul 2006)
ViewCVS:  http://svn.sourceforge.net/geany/?rev=562&view=rev

Log Message:
-----------
Show auto completion list immediately when called by a keybinding.

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/src/keybindings.c
    trunk/src/sci_cb.c
    trunk/src/sci_cb.h
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2006-07-15 12:34:56 UTC (rev 561)
+++ trunk/ChangeLog	2006-07-15 12:38:45 UTC (rev 562)
@@ -1,3 +1,9 @@
+2006-07-15  Enrico Tröger  <enrico.troeger at uvena.de>
+
+ * src/keybindings.c, src/sci_cb.c:
+   Show auto completion list immediately when called by a keybinding.
+
+
 2006-07-15  Nick Treleaven  <nick.treleaven at btinternet.com>
 
  * keybindings.c, keybindings.h: Add keybinding for Find in files.

Modified: trunk/src/keybindings.c
===================================================================
--- trunk/src/keybindings.c	2006-07-15 12:34:56 UTC (rev 561)
+++ trunk/src/keybindings.c	2006-07-15 12:38:45 UTC (rev 562)
@@ -702,7 +702,8 @@
 {
 	gint idx = document_get_cur_idx();
 	if (idx == -1 || ! doc_list[idx].is_valid) return;
-	sci_cb_start_auto_complete(doc_list[idx].sci, sci_get_current_position(doc_list[idx].sci), idx);
+	sci_cb_start_auto_complete(doc_list[idx].sci,
+					sci_get_current_position(doc_list[idx].sci), idx, TRUE);
 }
 
 static void cb_func_edit_calltip(void)

Modified: trunk/src/sci_cb.c
===================================================================
--- trunk/src/sci_cb.c	2006-07-15 12:34:56 UTC (rev 561)
+++ trunk/src/sci_cb.c	2006-07-15 12:38:45 UTC (rev 562)
@@ -190,7 +190,7 @@
 					if (doc_list[idx].use_auto_indention) sci_cb_close_block(sci, pos - 1);
 					break;
 				}
-				default: sci_cb_start_auto_complete(sci, pos, idx);
+				default: sci_cb_start_auto_complete(sci, pos, idx, FALSE);
 			}
 			break;
 		}
@@ -404,7 +404,7 @@
 }
 
 
-gboolean sci_cb_start_auto_complete(ScintillaObject *sci, gint pos, gint idx)
+gboolean sci_cb_start_auto_complete(ScintillaObject *sci, gint pos, gint idx, gboolean force)
 {
 	gint line, line_start, line_len, line_pos, current, rootlen, startword, lexer, style;
 	gchar *linebuf, *root;
@@ -460,16 +460,19 @@
 		TMTagAttrType attrs[] = { tm_tag_attr_name_t, 0 };
 
 		if (idx == -1 || ! doc_list[idx].is_valid || doc_list[idx].file_type == NULL)
-		{	// go home if typed less than 4 chars
+		{
 			g_free(linebuf);
 			return FALSE;
 		}
 
-		while ((line_pos - i >= 0) && ! g_ascii_isspace(linebuf[line_pos - i])) i++;
-		if (i < 4)
-		{	// go home if typed less than 4 chars
-			g_free(linebuf);
-			return FALSE;
+		if (! force)
+		{	// force is set when called by keyboard shortcut, otherwise start after at third char
+			while ((line_pos - i >= 0) && ! g_ascii_isspace(linebuf[line_pos - i])) i++;
+			if (i < 4)
+			{	// go home if typed less than 4 chars
+				g_free(linebuf);
+				return FALSE;
+			}
 		}
 
 		tags = tm_workspace_find(root, tm_tag_max_t, attrs, TRUE, doc_list[idx].file_type->lang);

Modified: trunk/src/sci_cb.h
===================================================================
--- trunk/src/sci_cb.h	2006-07-15 12:34:56 UTC (rev 561)
+++ trunk/src/sci_cb.h	2006-07-15 12:38:45 UTC (rev 562)
@@ -26,7 +26,7 @@
 // callback func called by all editors when a signals arises
 void on_editor_notification(GtkWidget* editor, gint scn, gpointer lscn, gpointer user_data);
 
-gboolean sci_cb_start_auto_complete(ScintillaObject *sci, gint pos, gint idx);
+gboolean sci_cb_start_auto_complete(ScintillaObject *sci, gint pos, gint idx, gboolean force);
 
 void sci_cb_get_indent(ScintillaObject *sci, gint pos, gboolean use_this_line);
 


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