SF.net SVN: geany: [1719] trunk

eht16 at users.sourceforge.net eht16 at xxxxx
Tue Jul 17 16:27:50 UTC 2007


Revision: 1719
          http://geany.svn.sourceforge.net/geany/?rev=1719&view=rev
Author:   eht16
Date:     2007-07-17 09:27:49 -0700 (Tue, 17 Jul 2007)

Log Message:
-----------
Add keybinding for scroll to current line.

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/doc/geany.docbook
    trunk/src/editor.c
    trunk/src/editor.h
    trunk/src/keybindings.c
    trunk/src/keybindings.h

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2007-07-17 16:11:38 UTC (rev 1718)
+++ trunk/ChangeLog	2007-07-17 16:27:49 UTC (rev 1719)
@@ -41,6 +41,9 @@
    Use GetFullPathName() instead of lrealpath() to get Tagmanager
    working on files containing special characters on Windows.
  * configure.in: Fix broken configure when using autoconf < 2.60.
+ * doc/geany.docbook, src/editor.c, src/editor.h, src/keybindings.c,
+   src/keybindings.h:
+   Add keybinding for scroll to current line.
 
 
 2007-07-16  Enrico Tröger  <enrico.troeger at uvena.de>

Modified: trunk/doc/geany.docbook
===================================================================
--- trunk/doc/geany.docbook	2007-07-17 16:11:38 UTC (rev 1718)
+++ trunk/doc/geany.docbook	2007-07-17 16:27:49 UTC (rev 1719)
@@ -1973,10 +1973,17 @@
 							</row>
 							<row>
 								<entry>Select current line</entry>
-								<entry>Selects the current line under the cursor..
+								<entry>Selects the current line under the cursor.
 								</entry>
 							</row>
 							<row>
+								<entry>Scroll to current line</entry>
+								<entry>Scrolls the current line into the centre of the view.
+									   The cursor position and or an existing selection will not
+									   be changed.
+								</entry>
+							</row>
+							<row>
 								<entry>Insert alternative whitespace</entry>
 								<entry>Inserts a tabulator character when spaces should be used for
 									   indentation and inserts space characters of the amount of a

Modified: trunk/src/editor.c
===================================================================
--- trunk/src/editor.c	2007-07-17 16:11:38 UTC (rev 1718)
+++ trunk/src/editor.c	2007-07-17 16:27:49 UTC (rev 1719)
@@ -160,7 +160,7 @@
 	 * http://scintilla.sourceforge.net/ScintillaDoc.html#LineWrapping */
 	if (doc_list[idx].scroll_percent > 0.0F)
 	{
-		scroll_to_line(sci, -1, doc_list[idx].scroll_percent);
+		editor_scroll_to_line(sci, -1, doc_list[idx].scroll_percent);
 		doc_list[idx].scroll_percent = -1.0F;	// disable further scrolling
 	}
 #if 0
@@ -2262,7 +2262,7 @@
 
 /* Scroll the view to make line appear at percent_of_view.
  * line can be -1 to use the current position. */
-static void scroll_to_line(ScintillaObject *sci, gint line, gfloat percent_of_view)
+void editor_scroll_to_line(ScintillaObject *sci, gint line, gfloat percent_of_view)
 {
 	gint vis1, los, delta;
 	GtkWidget *wid = GTK_WIDGET(sci);

Modified: trunk/src/editor.h
===================================================================
--- trunk/src/editor.h	2007-07-17 16:11:38 UTC (rev 1718)
+++ trunk/src/editor.h	2007-07-17 16:27:49 UTC (rev 1719)
@@ -147,6 +147,8 @@
 
 void editor_indentation_by_one_space(gint idx, gint pos, gboolean decrease);
 
+void editor_scroll_to_line(ScintillaObject *sci, gint line, gfloat percent_of_view);
+
 void editor_finalize();
 
 #endif

Modified: trunk/src/keybindings.c
===================================================================
--- trunk/src/keybindings.c	2007-07-17 16:11:38 UTC (rev 1718)
+++ trunk/src/keybindings.c	2007-07-17 16:27:49 UTC (rev 1719)
@@ -308,6 +308,8 @@
 		GDK_l, GDK_SHIFT_MASK | GDK_MOD1_MASK, "edit_selectline", _("Select current line"));
 	keys[GEANY_KEYS_EDIT_SELECTPARAGRAPH] = fill(cb_func_edit,
 		GDK_p, GDK_SHIFT_MASK | GDK_MOD1_MASK, "edit_selectparagraph", _("Select current paragraph"));
+	keys[GEANY_KEYS_EDIT_SCROLLTOLINE] = fill(cb_func_edit,
+		GDK_l, GDK_SHIFT_MASK | GDK_CONTROL_MASK, "edit_scrolltoline", _("Scroll to current line"));
 
 	keys[GEANY_KEYS_EDIT_INSERTALTWHITESPACE] = fill(cb_func_edit,
 		0, 0, "edit_insertwhitespace", _("Insert alternative whitespace"));
@@ -1088,6 +1090,9 @@
 
 	switch (key_id)
 	{
+		case GEANY_KEYS_EDIT_SCROLLTOLINE:
+			editor_scroll_to_line(doc_list[idx].sci, -1, 0.5F);
+			break;
 		case GEANY_KEYS_EDIT_DUPLICATELINE:
 			on_menu_duplicate_line1_activate(NULL, NULL);
 			break;

Modified: trunk/src/keybindings.h
===================================================================
--- trunk/src/keybindings.h	2007-07-17 16:11:38 UTC (rev 1718)
+++ trunk/src/keybindings.h	2007-07-17 16:27:49 UTC (rev 1719)
@@ -140,6 +140,7 @@
 	GEANY_KEYS_EDIT_SELECTWORD,
 	GEANY_KEYS_EDIT_SELECTLINE,
 	GEANY_KEYS_EDIT_SELECTPARAGRAPH,
+	GEANY_KEYS_EDIT_SCROLLTOLINE,
 	GEANY_KEYS_EDIT_INSERTALTWHITESPACE,
 
 	GEANY_KEYS_EDIT_AUTOCOMPLETE,


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