SF.net SVN: geany: [1413] trunk
eht16 at users.sourceforge.net
eht16 at xxxxx
Thu Mar 22 15:51:39 UTC 2007
Revision: 1413
http://svn.sourceforge.net/geany/?rev=1413&view=rev
Author: eht16
Date: 2007-03-22 08:51:39 -0700 (Thu, 22 Mar 2007)
Log Message:
-----------
Applied patch from Anh Ph?\225?\186?\161m to add a keybinding for selecting the current word under the cursor (thanks).
Modified Paths:
--------------
trunk/ChangeLog
trunk/THANKS
trunk/doc/geany.docbook
trunk/src/keybindings.c
trunk/src/keybindings.h
trunk/src/sci_cb.c
trunk/src/sci_cb.h
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2007-03-21 16:27:25 UTC (rev 1412)
+++ trunk/ChangeLog 2007-03-22 15:51:39 UTC (rev 1413)
@@ -1,3 +1,11 @@
+2007-03-22 Enrico Tröger <enrico.troeger at uvena.de>
+
+ * THANKS, doc/geany.docbook, src/keybindings.c, src/keybindings.h,
+ src/sci_cb.c, src/sci_cb.h:
+ Applied patch from Anh Phạm to add a keybinding for selecting the
+ current word under the cursor (thanks).
+
+
2007-03-21 Nick Treleaven <nick.treleaven at btinternet.com>
* src/project.c:
Modified: trunk/THANKS
===================================================================
--- trunk/THANKS 2007-03-21 16:27:25 UTC (rev 1412)
+++ trunk/THANKS 2007-03-22 15:51:39 UTC (rev 1413)
@@ -26,6 +26,7 @@
Dirk Weber <dietrich-weber(at)web(dot)de>
Slava Semushin <slava(dot)semushin(at)gmail(dot)com> - patch to improve SVN checks in cofigure script
John Gabriele <jmg3000(at)gmail(dot)com> - documentation patches
+Anh Phạm <cs(dot)phamtuananh(at)gmail(dot)com> - various patches
Translators:
----------------------------------
Modified: trunk/doc/geany.docbook
===================================================================
--- trunk/doc/geany.docbook 2007-03-21 16:27:25 UTC (rev 1412)
+++ trunk/doc/geany.docbook 2007-03-22 15:51:39 UTC (rev 1413)
@@ -1510,6 +1510,11 @@
</entry>
</row>
<row>
+ <entry>Select current word</entry>
+ <entry>Selects the current word under the cursor.
+ </entry>
+ </row>
+ <row>
<entry>Find Usage</entry>
<entry>Finds all occurrences of the current word (near the
keyboard cursor) and displays them in the messages window.
Modified: trunk/src/keybindings.c
===================================================================
--- trunk/src/keybindings.c 2007-03-21 16:27:25 UTC (rev 1412)
+++ trunk/src/keybindings.c 2007-03-22 15:51:39 UTC (rev 1413)
@@ -263,6 +263,9 @@
keys[GEANY_KEYS_EDIT_SUPPRESSCOMPLETION] = fill(cb_func_edit,
GDK_space, GDK_SHIFT_MASK, "edit_suppresscompletion", _("Suppress auto completion"));
+ keys[GEANY_KEYS_EDIT_SELECTWORD] = fill(cb_func_edit,
+ 0, 0, "edit_selectword", _("Select current word"));
+
keys[GEANY_KEYS_POPUP_FINDUSAGE] = fill(cb_func_current_word,
0, 0, "popup_findusage", _("Find Usage"));
keys[GEANY_KEYS_POPUP_GOTOTAGDEFINITION] = fill(cb_func_current_word,
@@ -862,6 +865,9 @@
case GEANY_KEYS_EDIT_SUPPRESSCOMPLETION:
sci_add_text(doc_list[idx].sci, " ");
break;
+ case GEANY_KEYS_EDIT_SELECTWORD:
+ sci_cb_select_word(doc_list[idx].sci);
+ break;
case GEANY_KEYS_EDIT_INCREASEINDENT:
on_menu_increase_indent1_activate(NULL, NULL);
break;
Modified: trunk/src/keybindings.h
===================================================================
--- trunk/src/keybindings.h 2007-03-21 16:27:25 UTC (rev 1412)
+++ trunk/src/keybindings.h 2007-03-22 15:51:39 UTC (rev 1413)
@@ -112,6 +112,7 @@
GEANY_KEYS_EDIT_CALLTIP,
GEANY_KEYS_EDIT_MACROLIST,
GEANY_KEYS_EDIT_SUPPRESSCOMPLETION,
+ GEANY_KEYS_EDIT_SELECTWORD,
GEANY_KEYS_POPUP_FINDUSAGE,
GEANY_KEYS_POPUP_GOTOTAGDEFINITION,
GEANY_KEYS_POPUP_GOTOTAGDECLARATION,
Modified: trunk/src/sci_cb.c
===================================================================
--- trunk/src/sci_cb.c 2007-03-21 16:27:25 UTC (rev 1412)
+++ trunk/src/sci_cb.c 2007-03-22 15:51:39 UTC (rev 1413)
@@ -2141,3 +2141,28 @@
//sci_scroll_caret(sci); // ensure visible (maybe not needed now)
}
+
+void sci_cb_select_word(ScintillaObject *sci)
+{
+ gint pos;
+ gint start;
+ gint end;
+
+ g_return_if_fail(sci != NULL);
+
+ pos = SSM(sci, SCI_GETCURRENTPOS, 0, 0);
+ start = SSM(sci, SCI_WORDSTARTPOSITION, pos, TRUE);
+ end = SSM(sci, SCI_WORDENDPOSITION, pos, TRUE);
+
+ if (start == end) // caret in whitespaces sequence
+ {
+ // look forward but reverse the selection direction,
+ // so the caret end up stay as near as the original position.
+ end = SSM(sci, SCI_WORDENDPOSITION, pos, FALSE);
+ start = SSM(sci, SCI_WORDENDPOSITION, end, TRUE);
+ if (start == end)
+ return;
+ }
+
+ SSM(sci, SCI_SETSEL, start, end);
+}
Modified: trunk/src/sci_cb.h
===================================================================
--- trunk/src/sci_cb.h 2007-03-21 16:27:25 UTC (rev 1412)
+++ trunk/src/sci_cb.h 2007-03-22 15:51:39 UTC (rev 1413)
@@ -86,4 +86,6 @@
void sci_cb_insert_multiline_comment(gint idx);
+void sci_cb_select_word(ScintillaObject *sci);
+
#endif
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