SF.net SVN: geany: [1892] trunk

ntrel at users.sourceforge.net ntrel at xxxxx
Fri Sep 21 16:39:21 UTC 2007


Revision: 1892
          http://geany.svn.sourceforge.net/geany/?rev=1892&view=rev
Author:   ntrel
Date:     2007-09-21 09:39:21 -0700 (Fri, 21 Sep 2007)

Log Message:
-----------
Make 'Duplicate lines' work for whole lines when more than one line
has a selection.

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/src/callbacks.c
    trunk/src/keybindings.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2007-09-21 16:37:19 UTC (rev 1891)
+++ trunk/ChangeLog	2007-09-21 16:39:21 UTC (rev 1892)
@@ -3,6 +3,9 @@
  * src/editor.c:
    Make 'Delete lines' not include an extra line when whole lines are
    selected.
+ * src/keybindings.c, src/callbacks.c:
+   Make 'Duplicate lines' work for whole lines when more than one line
+   has a selection.
 
 
 2007-09-18  Nick Treleaven  <nick(dot)treleaven(at)btinternet(dot)com>

Modified: trunk/src/callbacks.c
===================================================================
--- trunk/src/callbacks.c	2007-09-21 16:37:19 UTC (rev 1891)
+++ trunk/src/callbacks.c	2007-09-21 16:39:21 UTC (rev 1892)
@@ -1735,12 +1735,7 @@
 on_menu_duplicate_line1_activate       (GtkMenuItem     *menuitem,
                                         gpointer         user_data)
 {
-	gint idx = document_get_cur_idx();
-	if (idx == -1 || ! doc_list[idx].is_valid) return;
-	if (sci_can_copy(doc_list[idx].sci))
-		sci_selection_duplicate(doc_list[idx].sci);
-	else
-		sci_line_duplicate(doc_list[idx].sci);
+	keybindings_cmd(GEANY_KEYS_EDIT_DUPLICATELINE);
 }
 
 

Modified: trunk/src/keybindings.c
===================================================================
--- trunk/src/keybindings.c	2007-09-21 16:37:19 UTC (rev 1891)
+++ trunk/src/keybindings.c	2007-09-21 16:39:21 UTC (rev 1892)
@@ -1119,6 +1119,20 @@
 }
 
 
+static void duplicate_line(ScintillaObject *sci)
+{
+	if (sci_get_lines_selected(sci) > 1)
+	{
+		editor_select_lines(sci);
+		sci_selection_duplicate(sci);
+	}
+	else if (sci_can_copy(sci))
+		sci_selection_duplicate(sci);
+	else
+		sci_line_duplicate(sci);
+}
+
+
 // common function for editing keybindings, only valid when scintilla has focus.
 static void cb_func_edit(guint key_id)
 {
@@ -1140,7 +1154,7 @@
 			sci_cmd(doc_list[idx].sci, SCI_LINESCROLLDOWN);
 			break;
 		case GEANY_KEYS_EDIT_DUPLICATELINE:
-			on_menu_duplicate_line1_activate(NULL, NULL);
+			duplicate_line(doc_list[idx].sci);
 			break;
 		case GEANY_KEYS_EDIT_DELETELINE:
 			// SCI_LINEDELETE only does 1 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