Revision: 884 http://svn.sourceforge.net/geany/?rev=884&view=rev Author: eht16 Date: 2006-10-11 15:01:26 -0700 (Wed, 11 Oct 2006)
Log Message: ----------- Added keyboard shortcut Ctrl+< to jump between matching braces(closes #1571283).
Modified Paths: -------------- trunk/ChangeLog trunk/src/keybindings.c trunk/src/keybindings.h trunk/src/sciwrappers.c trunk/src/sciwrappers.h
Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2006-10-11 19:45:40 UTC (rev 883) +++ trunk/ChangeLog 2006-10-11 22:01:26 UTC (rev 884) @@ -6,6 +6,9 @@ tagmanager/parsers.h, tagmanager/diff.c, src/filetypes.c, src/treeviews.c: Added simple parser for filetype Diff to create tags for each patched file in a diff file. + * src/sci_wrappers.c: Added sci_find_bracematch(). + * src/keybindings.c: Added keyboard shortcut Ctrl+< to jump between + matching braces(closes #1571283).
Modified: trunk/src/keybindings.c =================================================================== --- trunk/src/keybindings.c 2006-10-11 19:45:40 UTC (rev 883) +++ trunk/src/keybindings.c 2006-10-11 22:01:26 UTC (rev 884) @@ -92,6 +92,7 @@ static void cb_func_edit_commentlinetoggle(void); static void cb_func_edit_uncommentline(void); static void cb_func_edit_increaseindent(void); +static void cb_func_edit_gotomatchingbrace(void); static void cb_func_edit_decreaseindent(void); static void cb_func_edit_autocomplete(void); static void cb_func_edit_calltip(void); @@ -214,6 +215,8 @@ GDK_i, GDK_CONTROL_MASK, "edit_increaseindent", _("Increase indent")); keys[GEANY_KEYS_EDIT_DECREASEINDENT] = fill(cb_func_edit_decreaseindent, GDK_i, GDK_SHIFT_MASK | GDK_CONTROL_MASK, "edit_decreaseindent", _("Decrease indent")); + keys[GEANY_KEYS_EDIT_GOTOMATCHINGBRACE] = fill(cb_func_edit_gotomatchingbrace, + GDK_less, GDK_CONTROL_MASK, "edit_gotomatchingbrace", _("Goto matching brace")); keys[GEANY_KEYS_EDIT_AUTOCOMPLETE] = fill(cb_func_edit_autocomplete, GDK_space, GDK_CONTROL_MASK, "edit_autocomplete", _("Complete word")); #ifdef G_OS_WIN32 @@ -796,6 +799,26 @@ on_menu_decrease_indent1_activate(NULL, NULL); }
+static void cb_func_edit_gotomatchingbrace(void) +{ + gint pos, new_pos; + gint idx = document_get_cur_idx(); + + if (! DOC_IDX_VALID(idx)) return; + + pos = sci_get_current_position(doc_list[idx].sci); + if (! utils_isbrace(sci_get_char_at(doc_list[idx].sci, pos))) + pos--; // set pos to the brace + + new_pos = sci_find_bracematch(doc_list[idx].sci, pos); + if (new_pos != -1) + { + gint line = sci_get_line_from_position(doc_list[idx].sci, new_pos); + sci_goto_line_scroll(doc_list[idx].sci, line, 0.5); + sci_goto_pos(doc_list[idx].sci, new_pos, FALSE); // set also the cursor the brace + } +} + static void cb_func_edit_tolowercase(void) { on_to_lower_case1_activate(NULL, NULL);
Modified: trunk/src/keybindings.h =================================================================== --- trunk/src/keybindings.h 2006-10-11 19:45:40 UTC (rev 883) +++ trunk/src/keybindings.h 2006-10-11 22:01:26 UTC (rev 884) @@ -90,6 +90,7 @@ GEANY_KEYS_EDIT_UNCOMMENTLINE, GEANY_KEYS_EDIT_INCREASEINDENT, GEANY_KEYS_EDIT_DECREASEINDENT, + GEANY_KEYS_EDIT_GOTOMATCHINGBRACE, GEANY_KEYS_EDIT_AUTOCOMPLETE, GEANY_KEYS_EDIT_CALLTIP, GEANY_KEYS_EDIT_MACROLIST,
Modified: trunk/src/sciwrappers.c =================================================================== --- trunk/src/sciwrappers.c 2006-10-11 19:45:40 UTC (rev 883) +++ trunk/src/sciwrappers.c 2006-10-11 22:01:26 UTC (rev 884) @@ -865,3 +865,9 @@ { SSM(sci, SCI_AUTOCSETMAXHEIGHT, val, 0); } + +gint sci_find_bracematch(ScintillaObject *sci, gint pos) +{ + return SSM(sci, SCI_BRACEMATCH, pos, 0); +} +
Modified: trunk/src/sciwrappers.h =================================================================== --- trunk/src/sciwrappers.h 2006-10-11 19:45:40 UTC (rev 883) +++ trunk/src/sciwrappers.h 2006-10-11 22:01:26 UTC (rev 884) @@ -157,5 +157,6 @@ void sci_select_all (ScintillaObject * sci); gint sci_get_line_indent_position(ScintillaObject * sci, gint line); void sci_set_autoc_max_height (ScintillaObject * sci, gint val); +gint sci_find_bracematch (ScintillaObject * sci, gint pos);
#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.