SF.net SVN: geany: [1674] trunk

eht16 at users.sourceforge.net eht16 at xxxxx
Sat Jul 7 15:12:14 UTC 2007


Revision: 1674
          http://svn.sourceforge.net/geany/?rev=1674&view=rev
Author:   eht16
Date:     2007-07-07 08:12:13 -0700 (Sat, 07 Jul 2007)

Log Message:
-----------
Add keybinding for Select, Transpose, Cut, Copy and Delete line.

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

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2007-07-07 14:19:06 UTC (rev 1673)
+++ trunk/ChangeLog	2007-07-07 15:12:13 UTC (rev 1674)
@@ -2,6 +2,9 @@
 
  * src/editor.c:
    Include new line character(s) when selecting a paragraph.
+ * doc/geany.docbook, src/document.c, src/editor.c, src/editor.h,
+   src/keybindings.c, src/keybindings.h:
+   Add keybinding for Select, Transpose, Cut, Copy and Delete line.
 
 
 2007-07-07  Nick Treleaven  <nick.treleaven at btinternet.com>

Modified: trunk/doc/geany.docbook
===================================================================
--- trunk/doc/geany.docbook	2007-07-07 14:19:06 UTC (rev 1673)
+++ trunk/doc/geany.docbook	2007-07-07 15:12:13 UTC (rev 1674)
@@ -1851,6 +1851,26 @@
 								<entry>Duplicates the current line or selection.</entry>
 							</row>
 							<row>
+								<entry>Delete current line</entry>
+								<entry>Deletes the current line.
+								</entry>
+							</row>
+							<row>
+								<entry>Cut current line</entry>
+								<entry>Cuts the current line.
+								</entry>
+							</row>
+							<row>
+								<entry>Copy current line</entry>
+								<entry>Copies the current line into the clipboard.
+								</entry>
+							</row>
+							<row>
+								<entry>Transpose current line</entry>
+								<entry>Transposes the current line with the previous one.
+								</entry>
+							</row>
+							<row>
 								<entry>Comment line</entry>
 								<entry>Comments current line or selection.</entry>
 							</row>
@@ -1937,6 +1957,11 @@
 								</entry>
 							</row>
 							<row>
+								<entry>Select current line</entry>
+								<entry>Selects the current line under the cursor..
+								</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/document.c
===================================================================
--- trunk/src/document.c	2007-07-07 14:19:06 UTC (rev 1673)
+++ trunk/src/document.c	2007-07-07 15:12:13 UTC (rev 1674)
@@ -301,8 +301,12 @@
 	sci_use_popup(sci, FALSE);
 	sci_assign_cmdkey(sci, SCK_HOME, SCI_VCHOMEWRAP);
 	sci_assign_cmdkey(sci, SCK_END,  SCI_LINEENDWRAP);
-	// disable select all to be able to redefine it
-	sci_clear_cmdkey(sci, 'A' | (SCMOD_CTRL << 16));
+	// disable some Scintilla keybinsings to be able to redefine it
+	sci_clear_cmdkey(sci, 'A' | (SCMOD_CTRL << 16)); // select all
+	sci_clear_cmdkey(sci, 'T' | (SCMOD_CTRL << 16)); // line transpose
+	sci_clear_cmdkey(sci, 'L' | (SCMOD_CTRL << 16)); // line cut
+	sci_clear_cmdkey(sci, 'L' | (SCMOD_CTRL << 16) | (SCMOD_SHIFT << 16)); // line delete
+	sci_clear_cmdkey(sci, 'T' | (SCMOD_CTRL << 16) | (SCMOD_SHIFT << 16)); // line copy
 
 	document_apply_update_prefs(new_idx);
 

Modified: trunk/src/editor.c
===================================================================
--- trunk/src/editor.c	2007-07-07 14:19:06 UTC (rev 1673)
+++ trunk/src/editor.c	2007-07-07 15:12:13 UTC (rev 1674)
@@ -2351,6 +2351,22 @@
 }
 
 
+void editor_select_line(ScintillaObject *sci)
+{
+	gint pos, line, start, end;
+
+	g_return_if_fail(sci != NULL);
+
+	pos = SSM(sci, SCI_GETCURRENTPOS, 0, 0);
+	line = SSM(sci, SCI_LINEFROMPOSITION, pos, 0);
+
+	start = SSM(sci, SCI_POSITIONFROMLINE, line, TRUE);
+	end = SSM(sci, SCI_POSITIONFROMLINE, line + 1, TRUE);
+
+	SSM(sci, SCI_SETSEL, start, end);
+}
+
+
 /* find the start or end of a paragraph by searching all lines in direction (UP or DOWN)
  * starting at the given line and return the found line or return -1 if called on an empty line */
 static gint find_paragraph_stop(ScintillaObject *sci, gint line, gint direction)

Modified: trunk/src/editor.h
===================================================================
--- trunk/src/editor.h	2007-07-07 14:19:06 UTC (rev 1673)
+++ trunk/src/editor.h	2007-07-07 15:12:13 UTC (rev 1674)
@@ -136,6 +136,8 @@
 
 void editor_select_word(ScintillaObject *sci);
 
+void editor_select_line(ScintillaObject *sci);
+
 void editor_select_paragraph(ScintillaObject *sci);
 
 void editor_insert_alternative_whitespace(ScintillaObject *sci);

Modified: trunk/src/keybindings.c
===================================================================
--- trunk/src/keybindings.c	2007-07-07 14:19:06 UTC (rev 1673)
+++ trunk/src/keybindings.c	2007-07-07 15:12:13 UTC (rev 1674)
@@ -171,7 +171,7 @@
 	keys[GEANY_KEYS_MENU_NEXTMESSAGE] = fill(cb_func_menu_nextmessage,
 		0, 0, "menu_nextmessage", _("Next Message"));
 	keys[GEANY_KEYS_MENU_GOTOLINE] = fill(cb_func_menu_gotoline,
-		GDK_j, GDK_CONTROL_MASK, "menu_gotoline", _("Go to line"));
+		GDK_l, GDK_CONTROL_MASK, "menu_gotoline", _("Go to line"));
 
 	keys[GEANY_KEYS_MENU_TOGGLEALL] = fill(cb_func_menu_toggle_all,
 		0, 0, "menu_toggleall", _("Toggle all additional widgets"));
@@ -244,6 +244,14 @@
 
 	keys[GEANY_KEYS_EDIT_DUPLICATELINE] = fill(cb_func_edit,
 		GDK_d, GDK_CONTROL_MASK, "edit_duplicateline", _("Duplicate line or selection"));
+	keys[GEANY_KEYS_EDIT_DELETELINE] = fill(cb_func_edit,
+		GDK_k, GDK_CONTROL_MASK, "edit_deleteline", _("Delete current line"));
+	keys[GEANY_KEYS_EDIT_COPYLINE] = fill(cb_func_edit,
+		GDK_k, GDK_MOD1_MASK | GDK_SHIFT_MASK, "edit_copyline", _("Copy current line"));
+	keys[GEANY_KEYS_EDIT_CUTLINE] = fill(cb_func_edit,
+		GDK_k, GDK_CONTROL_MASK | GDK_SHIFT_MASK, "edit_cutline", _("Cut current line"));
+	keys[GEANY_KEYS_EDIT_TRANSPOSELINE] = fill(cb_func_edit,
+		GDK_t, GDK_CONTROL_MASK, "edit_transposeline", _("Transpose current line"));
 	keys[GEANY_KEYS_EDIT_TOLOWERCASE] = fill(cb_func_edit,
 		GDK_u, GDK_CONTROL_MASK, "edit_tolowercase", _("Convert Selection to lower-case"));
 	keys[GEANY_KEYS_EDIT_TOUPPERCASE] = fill(cb_func_edit,
@@ -290,6 +298,8 @@
 
 	keys[GEANY_KEYS_EDIT_SELECTWORD] = fill(cb_func_edit,
 		GDK_w, GDK_SHIFT_MASK | GDK_MOD1_MASK, "edit_selectword", _("Select current word"));
+	keys[GEANY_KEYS_EDIT_SELECTLINE] = fill(cb_func_edit,
+		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"));
 
@@ -1095,6 +1105,15 @@
 		case GEANY_KEYS_EDIT_DUPLICATELINE:
 			on_menu_duplicate_line1_activate(NULL, NULL);
 			break;
+		case GEANY_KEYS_EDIT_DELETELINE:
+			sci_cmd(doc_list[idx].sci, SCI_LINEDELETE);
+			break;
+		case GEANY_KEYS_EDIT_CUTLINE:
+			sci_cmd(doc_list[idx].sci, SCI_LINECUT);
+			break;
+		case GEANY_KEYS_EDIT_TRANSPOSELINE:
+			sci_cmd(doc_list[idx].sci, SCI_LINETRANSPOSE);
+			break;
 		case GEANY_KEYS_EDIT_COMMENTLINETOGGLE:
 			on_menu_toggle_line_commentation1_activate(NULL, NULL);
 			break;
@@ -1131,6 +1150,9 @@
 		case GEANY_KEYS_EDIT_SELECTWORD:
 			editor_select_word(doc_list[idx].sci);
 			break;
+		case GEANY_KEYS_EDIT_SELECTLINE:
+			editor_select_line(doc_list[idx].sci);
+			break;
 		case GEANY_KEYS_EDIT_SELECTPARAGRAPH:
 			editor_select_paragraph(doc_list[idx].sci);
 			break;

Modified: trunk/src/keybindings.h
===================================================================
--- trunk/src/keybindings.h	2007-07-07 14:19:06 UTC (rev 1673)
+++ trunk/src/keybindings.h	2007-07-07 15:12:13 UTC (rev 1674)
@@ -115,6 +115,10 @@
 	GEANY_KEYS_EDIT_TOLOWERCASE,
 	GEANY_KEYS_EDIT_TOUPPERCASE,
 	GEANY_KEYS_EDIT_DUPLICATELINE,
+	GEANY_KEYS_EDIT_DELETELINE,
+	GEANY_KEYS_EDIT_COPYLINE,
+	GEANY_KEYS_EDIT_CUTLINE,
+	GEANY_KEYS_EDIT_TRANSPOSELINE,
 	GEANY_KEYS_EDIT_COMMENTLINETOGGLE,
 	GEANY_KEYS_EDIT_COMMENTLINE,
 	GEANY_KEYS_EDIT_UNCOMMENTLINE,
@@ -128,6 +132,7 @@
 	GEANY_KEYS_EDIT_GOTONEXTMARKER,
 	GEANY_KEYS_EDIT_GOTOPREVIOUSMARKER,
 	GEANY_KEYS_EDIT_SELECTWORD,
+	GEANY_KEYS_EDIT_SELECTLINE,
 	GEANY_KEYS_EDIT_SELECTPARAGRAPH,
 	GEANY_KEYS_EDIT_INSERTALTWHITESPACE,
 


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