Improve jumping to matching braces by consistently position the cursor before or after the matching brace dependent where it was before (patch by Dimitar Zhekov, thanks).
git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@4885 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
parent
812d9cc480
commit
6cd54a2cdd
@ -5,6 +5,10 @@
|
|||||||
style properly (closes #2998347).
|
style properly (closes #2998347).
|
||||||
* src/utils.c:
|
* src/utils.c:
|
||||||
Don't auto-close short XML tags (closes #2994852).
|
Don't auto-close short XML tags (closes #2994852).
|
||||||
|
* THANKS, src/about.c, src/keybindings.c:
|
||||||
|
Improve jumping to matching braces by consistently position the
|
||||||
|
cursor before or after the matching brace dependent where it
|
||||||
|
was before (patch by Dimitar Zhekov, thanks).
|
||||||
|
|
||||||
|
|
||||||
2010-05-07 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
|
2010-05-07 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
|
||||||
|
1
THANKS
1
THANKS
@ -76,6 +76,7 @@ Kelvin Gardiner <kelvin(at)mbmn(dot)net> - VHDL symbol list patch, Verilog filet
|
|||||||
Jon Senior <jon(at)restlesslemon(dot)co(dot)uk> - R tagmanager parser patch
|
Jon Senior <jon(at)restlesslemon(dot)co(dot)uk> - R tagmanager parser patch
|
||||||
Can Koy <cankoy(at)ymail(dot)com> - Multiple changes/improvements
|
Can Koy <cankoy(at)ymail(dot)com> - Multiple changes/improvements
|
||||||
Yoann Le Montagner <yoann(dot)le-montagner(at)m4x(dot)org> - set VTE bold color
|
Yoann Le Montagner <yoann(dot)le-montagner(at)m4x(dot)org> - set VTE bold color
|
||||||
|
Dimitar Zhekov <hamster(at)mbox(dot)contact(dot)bg> - matching brace improvements patch
|
||||||
|
|
||||||
Translators:
|
Translators:
|
||||||
------------
|
------------
|
||||||
|
@ -85,7 +85,7 @@ static const gchar *contributors =
|
|||||||
"Alexander Rodin, Alexey Antipov, Andrew Rowland, Anh Phạm, blackdog, Bo Lorentsen, Bob Doan, "
|
"Alexander Rodin, Alexey Antipov, Andrew Rowland, Anh Phạm, blackdog, Bo Lorentsen, Bob Doan, "
|
||||||
"Bronisław Białek, Can Koy, Catalin Marinas, "
|
"Bronisław Białek, Can Koy, Catalin Marinas, "
|
||||||
"Chris Macksey, Christoph Berg, Colomban Wendling, Conrad Steenberg, Daniel Richard G., Dave Moore, "
|
"Chris Macksey, Christoph Berg, Colomban Wendling, Conrad Steenberg, Daniel Richard G., Dave Moore, "
|
||||||
"Dirk Weber, Elias Pschernig, Eric Forgeot, Eugene Arshinov, Felipe Pena, François Cami, "
|
"Dimitar Zhekov, Dirk Weber, Elias Pschernig, Eric Forgeot, Eugene Arshinov, Felipe Pena, François Cami, "
|
||||||
"Giuseppe Torelli, Guillaume de Rorthais, Guillaume Hoffmann, Herbert Voss, Jason Oster, "
|
"Giuseppe Torelli, Guillaume de Rorthais, Guillaume Hoffmann, Herbert Voss, Jason Oster, "
|
||||||
"Jean-François Wauthy, Jeff Pohlmeyer, Jesse Mayes, John Gabriele, Jon Senior, Jon Strait, Josef Whiter, "
|
"Jean-François Wauthy, Jeff Pohlmeyer, Jesse Mayes, John Gabriele, Jon Senior, Jon Strait, Josef Whiter, "
|
||||||
"Jörn Reder, Kelvin Gardiner, Kevin Ellwood, Kristoffer A. Tjernås, Lex Trotman, Marko Peric, Matti Mårds, "
|
"Jörn Reder, Kelvin Gardiner, Kevin Ellwood, Kristoffer A. Tjernås, Lex Trotman, Marko Peric, Matti Mårds, "
|
||||||
|
@ -1905,18 +1905,19 @@ static void cb_func_move_tab(guint key_id)
|
|||||||
static void goto_matching_brace(GeanyDocument *doc)
|
static void goto_matching_brace(GeanyDocument *doc)
|
||||||
{
|
{
|
||||||
gint pos, new_pos;
|
gint pos, new_pos;
|
||||||
|
gint after_brace;
|
||||||
|
|
||||||
if (doc == NULL)
|
if (doc == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
pos = sci_get_current_position(doc->editor->sci);
|
pos = sci_get_current_position(doc->editor->sci);
|
||||||
if (! utils_isbrace(sci_get_char_at(doc->editor->sci, pos), TRUE))
|
after_brace = pos > 0 && utils_isbrace(sci_get_char_at(doc->editor->sci, pos - 1), TRUE);
|
||||||
pos--; /* set pos to the brace */
|
pos -= after_brace; /* set pos to the brace */
|
||||||
|
|
||||||
new_pos = sci_find_matching_brace(doc->editor->sci, pos);
|
new_pos = sci_find_matching_brace(doc->editor->sci, pos);
|
||||||
if (new_pos != -1)
|
if (new_pos != -1)
|
||||||
{ /* set the cursor at the brace */
|
{ /* set the cursor at/after the brace */
|
||||||
sci_set_current_position(doc->editor->sci, new_pos, FALSE);
|
sci_set_current_position(doc->editor->sci, new_pos + (!after_brace), FALSE);
|
||||||
editor_display_current_line(doc->editor, 0.5F);
|
editor_display_current_line(doc->editor, 0.5F);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user