join_lines: Remove sci_fix_selection_anchors function.

Previously it was useful because `reflow_lines`, in case when selection
contained trailing newline, removed that newline from selection by
calling `sci_set_selection_end` which only works when anchor > current
cursor position (it's mentioned in Scintilla's documentation on
SCI_SETSELECTIONEND).

Now trailing newline is removed by calling `sci_deselect_last_newline`
which uses `sci_set_selection` with `start` and `end` arguments.  This
function works regardless of the interposition of current cursor
position and anchor.
This commit is contained in:
Eugene Arshinov 2012-02-25 17:29:04 +04:00
parent f318b2cca0
commit 2d29296302

View File

@ -2157,17 +2157,6 @@ static void sci_deselect_last_newline(ScintillaObject *sci)
}
/* if cursor < anchor, swap them */
static void sci_fix_selection_anchors(ScintillaObject *sci)
{
gint start, end;
start = sci_get_selection_start(sci);
end = sci_get_selection_end(sci);
sci_set_selection(sci, start, end);
}
static void reflow_paragraph(GeanyEditor *editor)
{
ScintillaObject *sci = editor->sci;
@ -2186,7 +2175,6 @@ static void reflow_paragraph(GeanyEditor *editor)
if (!sel)
editor_select_indent_block(editor);
sci_deselect_last_newline(sci);
sci_fix_selection_anchors(sci);
reflow_lines(editor, column);
if (!sel)
sci_set_anchor(sci, -1);
@ -2213,7 +2201,6 @@ static void join_paragraph(GeanyEditor *editor)
if (!sel)
editor_select_indent_block(editor);
sci_deselect_last_newline(sci);
//sci_fix_selection_anchors(sci);
join_lines(editor);
if (!sel)
sci_set_anchor(sci, -1);