Skip to content

Instantly share code, notes, and snippets.

@Ryan1729
Created November 13, 2017 06:42
Show Gist options
  • Save Ryan1729/2244914f0ac7856fed42f8379fb4cd36 to your computer and use it in GitHub Desktop.
Save Ryan1729/2244914f0ac7856fed42f8379fb4cd36 to your computer and use it in GitHub Desktop.
diff against geany/geany @ dd58ab6
diff --git a/src/editor.c b/src/editor.c
index 460c832a..0cee854c 100644
--- a/src/editor.c
+++ b/src/editor.c
@@ -315,15 +315,7 @@ static gboolean on_editor_button_press_event(GtkWidget *widget, GdkEventButton *
}
if (event->type == GDK_BUTTON_PRESS && state == GEANY_PRIMARY_MOD_MASK)
{
- sci_set_current_position(editor->sci, editor_info.click_pos, FALSE);
-
- editor_find_current_word(editor, editor_info.click_pos,
- current_word, sizeof current_word, NULL);
- if (*current_word)
- return symbols_goto_tag(current_word, TRUE);
- else
- keybindings_send_command(GEANY_KEY_GROUP_GOTO, GEANY_KEYS_GOTO_MATCHINGBRACE);
- return TRUE;
+ sci_add_selection(editor->sci, editor_info.click_pos, editor_info.click_pos);
}
return document_check_disk_status(doc, FALSE);
}
@@ -4920,6 +4912,8 @@ static ScintillaObject *create_new_sci(GeanyEditor *editor)
setup_sci_keys(sci);
+ sci_set_multiple_selection(sci, TRUE);
+
sci_set_symbol_margin(sci, editor_prefs.show_markers_margin);
sci_set_lines_wrapped(sci, editor->line_wrapping);
sci_set_caret_policy_x(sci, CARET_JUMPS | CARET_EVEN, 0);
diff --git a/src/sciwrappers.c b/src/sciwrappers.c
index eb9a8e8e..682f4241 100644
--- a/src/sciwrappers.c
+++ b/src/sciwrappers.c
@@ -201,6 +201,21 @@ void sci_set_lines_wrapped(ScintillaObject *sci, gboolean set)
SSM(sci, SCI_SETWRAPMODE, SC_WRAP_NONE, 0);
}
+void sci_set_multiple_selection(ScintillaObject *sci, gboolean set)
+{
+ SSM(sci, SCI_SETMULTIPLESELECTION, set, 0);
+}
+
+gboolean sci_get_multiple_selection(ScintillaObject *sci)
+{
+ return SSM(sci, SCI_GETMULTIPLESELECTION, 0, 0);
+}
+
+void sci_add_selection(ScintillaObject *sci, gint caret, gint anchor)
+{
+ g_warning("SCI_ADDSELECTION %d", SCI_ADDSELECTION);
+ return SSM(sci, SCI_ADDSELECTION, caret, anchor);
+}
gint sci_get_eol_mode(ScintillaObject *sci)
{
diff --git a/src/sciwrappers.h b/src/sciwrappers.h
index c7f61abc..7789b59e 100644
--- a/src/sciwrappers.h
+++ b/src/sciwrappers.h
@@ -137,6 +137,12 @@ void sci_toggle_marker_at_line (ScintillaObject *sci, gint line, gint marker)
gint sci_marker_next (ScintillaObject *sci, gint line, gint marker_mask, gboolean wrap);
gint sci_marker_previous (ScintillaObject *sci, gint line, gint marker_mask, gboolean wrap);
+void sci_set_multiple_selection (ScintillaObject *sci, gboolean set);
+
+gboolean sci_get_multiple_selection (ScintillaObject *sci);
+
+void sci_add_selection (ScintillaObject *sci, gint caret, gint anchor);
+
gint sci_get_position_from_col (ScintillaObject *sci, gint line, gint col);
void sci_set_current_line (ScintillaObject *sci, gint line);
gint sci_get_cursor_virtual_space(ScintillaObject *sci);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment