SF.net SVN: geany: [1807] trunk

ntrel at users.sourceforge.net ntrel at xxxxx
Thu Aug 16 16:56:20 UTC 2007


Revision: 1807
          http://geany.svn.sourceforge.net/geany/?rev=1807&view=rev
Author:   ntrel
Date:     2007-08-16 09:56:17 -0700 (Thu, 16 Aug 2007)

Log Message:
-----------
Use sci_assign_cmdkey() to set GtkEntry-like word boundary handling.
Clear unnecessary default Scintilla Ctrl-D duplicate keybinding.
Add SCI_DELWORDRIGHTEND command (patch sent to Scintilla ML).
Remove previous ScintillaGTK::KeyCommand override.

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/doc/geany.txt
    trunk/scintilla/Editor.cxx
    trunk/scintilla/ScintillaGTK.cxx
    trunk/scintilla/include/Scintilla.h
    trunk/src/document.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2007-08-16 16:49:17 UTC (rev 1806)
+++ trunk/ChangeLog	2007-08-16 16:56:17 UTC (rev 1807)
@@ -7,6 +7,12 @@
    geany.glade:
    Add 'Enable plugin support' Prefs checkbox.
    Minor edit of load VTE option text.
+ * scintilla/include/Scintilla.h, scintilla/Editor.cxx,
+   scintilla/ScintillaGTK.cxx, src/document.c, doc/geany.txt:
+   Use sci_assign_cmdkey() to set GtkEntry-like word boundary handling.
+   Clear unnecessary default Scintilla Ctrl-D duplicate keybinding.
+   Add SCI_DELWORDRIGHTEND command (patch sent to Scintilla ML).
+   Remove previous ScintillaGTK::KeyCommand override.
 
 
 2007-08-16  Enrico Tröger  <enrico(dot)troeger(at)uvena(dot)de>

Modified: trunk/doc/geany.txt
===================================================================
--- trunk/doc/geany.txt	2007-08-16 16:49:17 UTC (rev 1806)
+++ trunk/doc/geany.txt	2007-08-16 16:56:17 UTC (rev 1807)
@@ -2141,11 +2141,6 @@
 Extend selection to end of display line.        Alt+Shift+End
 Scroll up.                                      Ctrl+Up
 Scroll down.                                    Ctrl+Down
-Line cut.                                       Ctrl+L
-Line copy.                                      Ctrl+Shift+T
-Line delete.                                    Ctrl+Shift+L
-Line transpose with previous.                   Ctrl+T
-Selection duplicate.                            Ctrl+D
 Previous paragraph. Shift extends selection.    Ctrl+[
 Next paragraph. Shift extends selection.        Ctrl+]
 Previous word. Shift extends selection.         Ctrl+Left

Modified: trunk/scintilla/Editor.cxx
===================================================================
--- trunk/scintilla/Editor.cxx	2007-08-16 16:49:17 UTC (rev 1806)
+++ trunk/scintilla/Editor.cxx	2007-08-16 16:56:17 UTC (rev 1807)
@@ -3866,6 +3866,7 @@
 	case SCI_VCHOMEWRAPEXTEND:
 	case SCI_DELWORDLEFT:
 	case SCI_DELWORDRIGHT:
+	case SCI_DELWORDRIGHTEND:
 	case SCI_DELLINELEFT:
 	case SCI_DELLINERIGHT:
 	case SCI_LINECOPY:
@@ -4426,6 +4427,11 @@
 			pdoc->DeleteChars(currentPos, endWord - currentPos);
 		}
 		break;
+	case SCI_DELWORDRIGHTEND: {
+			int endWord = pdoc->NextWordEnd(currentPos, 1);
+			pdoc->DeleteChars(currentPos, endWord - currentPos);
+		}
+		break;
 	case SCI_DELLINELEFT: {
 			int line = pdoc->LineFromPosition(currentPos);
 			int start = pdoc->LineStart(line);
@@ -7125,6 +7131,7 @@
 	case SCI_ZOOMOUT:
 	case SCI_DELWORDLEFT:
 	case SCI_DELWORDRIGHT:
+	case SCI_DELWORDRIGHTEND:
 	case SCI_DELLINELEFT:
 	case SCI_DELLINERIGHT:
 	case SCI_LINECOPY:

Modified: trunk/scintilla/ScintillaGTK.cxx
===================================================================
--- trunk/scintilla/ScintillaGTK.cxx	2007-08-16 16:49:17 UTC (rev 1806)
+++ trunk/scintilla/ScintillaGTK.cxx	2007-08-16 16:56:17 UTC (rev 1807)
@@ -285,9 +285,6 @@
 
 	static sptr_t DirectFunction(ScintillaGTK *sciThis,
 	                             unsigned int iMessage, uptr_t wParam, sptr_t lParam);
-
-protected:
-	virtual int KeyCommand(unsigned int iMessage);
 };
 
 enum {
@@ -2723,32 +2720,3 @@
 void scintilla_release_resources(void) {
 	Platform_Finalise();
 }
-
-int ScintillaGTK::KeyCommand(unsigned int iMessage) {
-	switch (iMessage) {
-	/* Try to act more like a GtkWidget, e.g. GtkEntry.
-	 * The container app should also call SCI_SETWHITESPACECHARS to include punctuation
-	 * chars as whitespace. */
-	case SCI_WORDRIGHT:
-		MovePositionTo(MovePositionSoVisible(pdoc->NextWordEnd(currentPos, 1), 1));
-		SetLastXChosen();
-		break;
-	case SCI_WORDRIGHTEXTEND:
-		MovePositionTo(MovePositionSoVisible(pdoc->NextWordEnd(currentPos, 1), 1), selStream);
-		SetLastXChosen();
-		break;
-	case SCI_DELWORDRIGHT: {
-			int endWord = pdoc->NextWordEnd(currentPos, 1);
-			pdoc->DeleteChars(currentPos, endWord - currentPos);
-		}
-		break;
-	default:
-		return ScintillaBase::KeyCommand(iMessage);
-	}
-	/* Mimic what ScintillaBase::KeyCommand would do as we're overriding it. */
-	if (ac.Active())
-		ac.Cancel();
-	if (ct.inCallTipMode)
-		ct.CallTipCancel();
-	return 0;
-}

Modified: trunk/scintilla/include/Scintilla.h
===================================================================
--- trunk/scintilla/include/Scintilla.h	2007-08-16 16:49:17 UTC (rev 1806)
+++ trunk/scintilla/include/Scintilla.h	2007-08-16 16:56:17 UTC (rev 1807)
@@ -499,6 +499,7 @@
 #define SCI_ZOOMOUT 2334
 #define SCI_DELWORDLEFT 2335
 #define SCI_DELWORDRIGHT 2336
+#define SCI_DELWORDRIGHTEND 2518
 #define SCI_LINECUT 2337
 #define SCI_LINEDELETE 2338
 #define SCI_LINETRANSPOSE 2339

Modified: trunk/src/document.c
===================================================================
--- trunk/src/document.c	2007-08-16 16:49:17 UTC (rev 1806)
+++ trunk/src/document.c	2007-08-16 16:56:17 UTC (rev 1807)
@@ -265,6 +265,23 @@
 }
 
 
+static void setup_sci_keys(ScintillaObject *sci)
+{
+	// disable some Scintilla keybindings to be able to redefine them cleanly
+	sci_clear_cmdkey(sci, 'A' | (SCMOD_CTRL << 16)); // select all
+	sci_clear_cmdkey(sci, 'D' | (SCMOD_CTRL << 16)); // duplicate
+	sci_clear_cmdkey(sci, 'T' | (SCMOD_CTRL << 16)); // line transpose
+	sci_clear_cmdkey(sci, 'T' | (SCMOD_CTRL << 16) | (SCMOD_SHIFT << 16)); // line copy
+	sci_clear_cmdkey(sci, 'L' | (SCMOD_CTRL << 16)); // line cut
+	sci_clear_cmdkey(sci, 'L' | (SCMOD_CTRL << 16) | (SCMOD_SHIFT << 16)); // line delete
+
+	// use GtkEntry-like word boundaries
+	sci_assign_cmdkey(sci, SCK_RIGHT | (SCMOD_CTRL << 16), SCI_WORDRIGHTEND);
+	sci_assign_cmdkey(sci, SCK_RIGHT | (SCMOD_CTRL << 16) | (SCMOD_SHIFT << 16), SCI_WORDRIGHTENDEXTEND);
+	sci_assign_cmdkey(sci, SCK_DELETE | (SCMOD_CTRL << 16), SCI_DELWORDRIGHTEND);
+}
+
+
 /* creates a new tab in the notebook and does all related stuff
  * finally it returns the index of the created document */
 static gint document_create_new_sci(const gchar *filename)
@@ -305,13 +322,9 @@
 	//SSM(sci, SCI_SETWRAPSTARTINDENT, 4, 0);
 	// disable scintilla provided popup menu
 	sci_use_popup(sci, FALSE);
-	// 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
 
+	setup_sci_keys(sci);
+
 	document_apply_update_prefs(new_idx);
 
 	sci_set_tab_indents(sci, app->use_tab_to_indent);


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