Fix cursor positioning when toggling comments (patch by Thomas Martitz, thanks).

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@4788 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Enrico Tröger 2010-03-25 23:00:59 +00:00
parent 06786651bd
commit 09d0321657
2 changed files with 19 additions and 6 deletions

View File

@ -1,3 +1,10 @@
2010-03-25 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
* src/editor.c:
Fix cursor positioning when toggling comments
(patch by Thomas Martitz, thanks).
2010-03-25 Peter Scholtens <peter(dot)scholtens(at)xs4all(dot)nl>
* src/keybindings.[hc]:

View File

@ -2944,19 +2944,25 @@ void editor_do_comment_toggle(GeanyEditor *editor)
gint eol_len = editor_get_eol_char_len(editor);
if (count_uncommented > 0)
{
sci_set_selection_start(editor->sci, sel_start - co_len - eol_len);
sci_set_selection_end(editor->sci, sel_end - co_len - eol_len);
sci_set_selection_start(editor->sci, sel_start - co_len + eol_len);
sci_set_selection_end(editor->sci, sel_end - co_len + eol_len);
}
else
else if (count_commented > 0)
{
sci_set_selection_start(editor->sci, sel_start + co_len + eol_len);
sci_set_selection_end(editor->sci, sel_end + co_len + eol_len);
sci_set_selection_start(editor->sci, sel_start + co_len - eol_len);
sci_set_selection_end(editor->sci, sel_end + co_len - eol_len);
}
}
}
else if (count_uncommented > 0)
{
sci_set_current_position(editor->sci, sel_start - co_len, TRUE);
gint eol_len = single_line ? 0: editor_get_eol_char_len(editor);
sci_set_current_position(editor->sci, sel_start - co_len + eol_len, TRUE);
}
else if (count_commented > 0)
{
gint eol_len = single_line ? 0: editor_get_eol_char_len(editor);
sci_set_current_position(editor->sci, sel_start + co_len - eol_len, TRUE);
}
}