[geany/geany-plugins] de14d2: Merge pull request #568 from zhekov/workaround-for-sci-rect-bug
Frank Lanitz
git-noreply at xxxxx
Sat Apr 29 10:34:36 UTC 2017
Branch: refs/heads/master
Author: Frank Lanitz <frank at frank.uvena.de>
Committer: GitHub <noreply at github.com>
Date: Sat, 29 Apr 2017 10:34:36 UTC
Commit: de14d233579e61a761d88c99d25e55033fb2e661
https://github.com/geany/geany-plugins/commit/de14d233579e61a761d88c99d25e55033fb2e661
Log Message:
-----------
Merge pull request #568 from zhekov/workaround-for-sci-rect-bug
Workarounds for Scintilla rectangle selection bug(s)
Modified Paths:
--------------
geanyextrasel/src/extrasel.c
Modified: geanyextrasel/src/extrasel.c
30 lines changed, 14 insertions(+), 16 deletions(-)
===================================================================
@@ -104,7 +104,12 @@ static void create_selection(ScintillaObject *sci, int anchor, int anchor_space,
sci_set_anchor_space(sci, anchor_space);
sci_set_cursor_space(sci, cursor_space);
- sci_send_command(sci, SCI_CANCEL);
+
+ /* SCI bug: CANCEL may reduce a rectangle selection to a single line */
+ if (rectangle)
+ sci_set_selection_mode(sci, SC_SEL_RECTANGLE);
+ else
+ sci_send_command(sci, SCI_CANCEL);
}
static void convert_selection(ScintillaObject *sci, gboolean rectangle)
@@ -137,23 +142,16 @@ static const command_key command_keys[] =
static void column_mode_command(ScintillaObject *sci, int command)
{
- gboolean convert = !sci_rectangle_selection(sci);
- int anchor;
- int anchor_space;
+ /* In the current SCI versions, using the command_keys->command for
+ rectangular selection creates various problems. So we select a
+ stream instead, and convert it to rectangle. It's slower, but all
+ command-s move the cursor at least a word. */
+ int anchor = sci_get_anchor(sci);
+ int anchor_space = sci_get_anchor_space(sci);
- if (convert)
- {
- anchor = sci_get_anchor(sci);
- anchor_space = sci_get_anchor_space(sci);
- }
- sci_set_selection_mode(sci, SC_SEL_RECTANGLE);
+ sci_set_selection_mode(sci, SC_SEL_STREAM);
sci_send_command(sci, command);
- if (convert)
- {
- sci_set_anchor(sci, anchor);
- sci_set_anchor_space(sci, anchor_space);
- }
- sci_send_command(sci, SCI_CANCEL);
+ create_selection(sci, anchor, anchor_space, TRUE);
}
static gboolean on_key_press_event(GtkWidget *widget, GdkEventKey *event,
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
More information about the Plugins-Commits
mailing list