[gnome-builder] source-view: add Vim quote text-objects support
- From: Sébastien Lafargue <slafargue src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] source-view: add Vim quote text-objects support
- Date: Thu, 5 Nov 2015 23:31:48 +0000 (UTC)
commit c3158abff3be023e9b1e30a00fb93a5b0c8674ac
Author: Sebastien Lafargue <slafargue gnome org>
Date: Fri Oct 23 22:58:52 2015 +0200
source-view: add Vim quote text-objects support
data/keybindings/vim.css | 120 ++++++++++++++++++------------------
libide/ide-source-view-movements.c | 87 +++++++++++++++++++++-----
libide/ide-source-view-movements.h | 3 +-
libide/ide-source-view.c | 13 +++-
libide/ide-source-view.h | 3 +-
5 files changed, 146 insertions(+), 80 deletions(-)
---
diff --git a/data/keybindings/vim.css b/data/keybindings/vim.css
index 230341a..c348850 100644
--- a/data/keybindings/vim.css
+++ b/data/keybindings/vim.css
@@ -703,21 +703,21 @@
/* ci( , ci) , cib */
bind "parenleft" { "begin-macro" ()
- "select-inner" ("(", ")", 1)
+ "select-inner" ("(", ")", 1, 0)
"set-mode" ("vim-insert", permanent)
"copy-clipboard" ()
"selection-theatric" (shrink)
"delete-selection" () };
bind "parenright" { "begin-macro" ()
- "select-inner" ("(", ")", 1)
+ "select-inner" ("(", ")", 1, 0)
"set-mode" ("vim-insert", permanent)
"copy-clipboard" ()
"selection-theatric" (shrink)
"delete-selection" () };
bind "b" { "begin-macro" ()
- "select-inner" ("(", ")", 1)
+ "select-inner" ("(", ")", 1, 0)
"set-mode" ("vim-insert", permanent)
"copy-clipboard" ()
"selection-theatric" (shrink)
@@ -725,14 +725,14 @@
/* ci[ and ci] */
bind "bracketleft" { "begin-macro" ()
- "select-inner" ("[", "]", 1)
+ "select-inner" ("[", "]", 1, 0)
"set-mode" ("vim-insert", permanent)
"copy-clipboard" ()
"selection-theatric" (shrink)
"delete-selection" () };
bind "bracketright" { "begin-macro" ()
- "select-inner" ("[", "]", 1)
+ "select-inner" ("[", "]", 1, 0)
"set-mode" ("vim-insert", permanent)
"copy-clipboard" ()
"selection-theatric" (shrink)
@@ -740,21 +740,21 @@
/* ci{ , ci} , ciB */
bind "braceleft" { "begin-macro" ()
- "select-inner" ("{", "}", 1)
+ "select-inner" ("{", "}", 1, 0)
"set-mode" ("vim-insert", permanent)
"copy-clipboard" ()
"selection-theatric" (shrink)
"delete-selection" () };
bind "braceright" { "begin-macro" ()
- "select-inner" ("{", "}", 1)
+ "select-inner" ("{", "}", 1, 0)
"set-mode" ("vim-insert", permanent)
"copy-clipboard" ()
"selection-theatric" (shrink)
"delete-selection" () };
bind "<shift>b" { "begin-macro" ()
- "select-inner" ("{", "}", 1)
+ "select-inner" ("{", "}", 1, 0)
"set-mode" ("vim-insert", permanent)
"copy-clipboard" ()
"selection-theatric" (shrink)
@@ -762,14 +762,14 @@
/* ci< and ci> */
bind "less" { "begin-macro" ()
- "select-inner" ("<", ">", 1)
+ "select-inner" ("<", ">", 1, 0)
"set-mode" ("vim-insert", permanent)
"copy-clipboard" ()
"selection-theatric" (shrink)
"delete-selection" () };
bind "greater" { "begin-macro" ()
- "select-inner" ("<", ">", 1)
+ "select-inner" ("<", ">", 1, 0)
"set-mode" ("vim-insert", permanent)
"copy-clipboard" ()
"selection-theatric" (shrink)
@@ -780,21 +780,21 @@
{
/* ca( , ca) , cab */
bind "parenleft" { "begin-macro" ()
- "select-inner" ("(", ")", 0)
+ "select-inner" ("(", ")", 0, 0)
"set-mode" ("vim-insert", permanent)
"copy-clipboard" ()
"selection-theatric" (shrink)
"delete-selection" () };
bind "parenright" { "begin-macro" ()
- "select-inner" ("(", ")", 0)
+ "select-inner" ("(", ")", 0, 0)
"set-mode" ("vim-insert", permanent)
"copy-clipboard" ()
"selection-theatric" (shrink)
"delete-selection" () };
bind "b" { "begin-macro" ()
- "select-inner" ("(", ")", 0)
+ "select-inner" ("(", ")", 0, 0)
"set-mode" ("vim-insert", permanent)
"copy-clipboard" ()
"selection-theatric" (shrink)
@@ -802,14 +802,14 @@
/* ca[ and ca] */
bind "bracketleft" { "begin-macro" ()
- "select-inner" ("[", "]", 0)
+ "select-inner" ("[", "]", 0, 0)
"set-mode" ("vim-insert", permanent)
"copy-clipboard" ()
"selection-theatric" (shrink)
"delete-selection" () };
bind "bracketright" { "begin-macro" ()
- "select-inner" ("[", "]", 0)
+ "select-inner" ("[", "]", 0, 0)
"set-mode" ("vim-insert", permanent)
"copy-clipboard" ()
"selection-theatric" (shrink)
@@ -817,21 +817,21 @@
/* ca{ , ca} , caB */
bind "braceleft" { "begin-macro" ()
- "select-inner" ("{", "}", 0)
+ "select-inner" ("{", "}", 0, 0)
"set-mode" ("vim-insert", permanent)
"copy-clipboard" ()
"selection-theatric" (shrink)
"delete-selection" () };
bind "braceright" { "begin-macro" ()
- "select-inner" ("{", "}", 0)
+ "select-inner" ("{", "}", 0, 0)
"set-mode" ("vim-insert", permanent)
"copy-clipboard" ()
"selection-theatric" (shrink)
"delete-selection" () };
bind "<shift>b" { "begin-macro" ()
- "select-inner" ("{", "}", 0)
+ "select-inner" ("{", "}", 0, 0)
"set-mode" ("vim-insert", permanent)
"copy-clipboard" ()
"selection-theatric" (shrink)
@@ -839,14 +839,14 @@
/* ca< and ca> */
bind "less" { "begin-macro" ()
- "select-inner" ("<", ">", 0)
+ "select-inner" ("<", ">", 0, 0)
"set-mode" ("vim-insert", permanent)
"copy-clipboard" ()
"selection-theatric" (shrink)
"delete-selection" () };
bind "greater" { "begin-macro" ()
- "select-inner" ("<", ">", 0)
+ "select-inner" ("<", ">", 0, 0)
"set-mode" ("vim-insert", permanent)
"copy-clipboard" ()
"selection-theatric" (shrink)
@@ -1246,21 +1246,21 @@
/* di( , di) , dib */
bind "parenleft" { "begin-macro" ()
- "select-inner" ("(", ")", 1)
+ "select-inner" ("(", ")", 1, 0)
"set-mode" ("vim-normal", permanent)
"copy-clipboard" ()
"selection-theatric" (shrink)
"delete-selection" () };
bind "parenright" { "begin-macro" ()
- "select-inner" ("(", ")", 1)
+ "select-inner" ("(", ")", 1, 0)
"set-mode" ("vim-normal", permanent)
"copy-clipboard" ()
"selection-theatric" (shrink)
"delete-selection" () };
bind "b" { "begin-macro" ()
- "select-inner" ("(", ")", 1)
+ "select-inner" ("(", ")", 1, 0)
"set-mode" ("vim-normal", permanent)
"copy-clipboard" ()
"selection-theatric" (shrink)
@@ -1268,14 +1268,14 @@
/* di[ and di] */
bind "bracketleft" { "begin-macro" ()
- "select-inner" ("[", "]", 1)
+ "select-inner" ("[", "]", 1, 0)
"set-mode" ("vim-normal", permanent)
"copy-clipboard" ()
"selection-theatric" (shrink)
"delete-selection" () };
bind "bracketright" { "begin-macro" ()
- "select-inner" ("[", "]", 1)
+ "select-inner" ("[", "]", 1, 0)
"set-mode" ("vim-normal", permanent)
"copy-clipboard" ()
"selection-theatric" (shrink)
@@ -1283,21 +1283,21 @@
/* di{ , di} , diB */
bind "braceleft" { "begin-macro" ()
- "select-inner" ("{", "}", 1)
+ "select-inner" ("{", "}", 1, 0)
"set-mode" ("vim-normal", permanent)
"copy-clipboard" ()
"selection-theatric" (shrink)
"delete-selection" () };
bind "braceright" { "begin-macro" ()
- "select-inner" ("{", "}", 1)
+ "select-inner" ("{", "}", 1, 0)
"set-mode" ("vim-normal", permanent)
"copy-clipboard" ()
"selection-theatric" (shrink)
"delete-selection" () };
bind "<shift>b" { "begin-macro" ()
- "select-inner" ("{", "}", 1)
+ "select-inner" ("{", "}", 1, 0)
"set-mode" ("vim-normal", permanent)
"copy-clipboard" ()
"selection-theatric" (shrink)
@@ -1305,14 +1305,14 @@
/* di< and di> */
bind "less" { "begin-macro" ()
- "select-inner" ("<", ">", 1)
+ "select-inner" ("<", ">", 1, 0)
"set-mode" ("vim-normal", permanent)
"copy-clipboard" ()
"selection-theatric" (shrink)
"delete-selection" () };
bind "greater" { "begin-macro" ()
- "select-inner" ("<", ">", 1)
+ "select-inner" ("<", ">", 1, 0)
"set-mode" ("vim-normal", permanent)
"copy-clipboard" ()
"selection-theatric" (shrink)
@@ -1323,21 +1323,21 @@
{
/* da( , da) , dab */
bind "parenleft" { "begin-macro" ()
- "select-inner" ("(", ")", 0)
+ "select-inner" ("(", ")", 0, 0)
"set-mode" ("vim-normal", permanent)
"copy-clipboard" ()
"selection-theatric" (shrink)
"delete-selection" () };
bind "parenright" { "begin-macro" ()
- "select-inner" ("(", ")", 0)
+ "select-inner" ("(", ")", 0, 0)
"set-mode" ("vim-normal", permanent)
"copy-clipboard" ()
"selection-theatric" (shrink)
"delete-selection" () };
bind "b" { "begin-macro" ()
- "select-inner" ("(", ")", 0)
+ "select-inner" ("(", ")", 0, 0)
"set-mode" ("vim-normal", permanent)
"copy-clipboard" ()
"selection-theatric" (shrink)
@@ -1345,14 +1345,14 @@
/* da[ and da] */
bind "bracketleft" { "begin-macro" ()
- "select-inner" ("[", "]", 0)
+ "select-inner" ("[", "]", 0, 0)
"set-mode" ("vim-normal", permanent)
"copy-clipboard" ()
"selection-theatric" (shrink)
"delete-selection" () };
bind "bracketright" { "begin-macro" ()
- "select-inner" ("[", "]", 0)
+ "select-inner" ("[", "]", 0, 0)
"set-mode" ("vim-normal", permanent)
"copy-clipboard" ()
"selection-theatric" (shrink)
@@ -1360,21 +1360,21 @@
/* da{ , da} , daB */
bind "braceleft" { "begin-macro" ()
- "select-inner" ("{", "}", 0)
+ "select-inner" ("{", "}", 0, 0)
"set-mode" ("vim-normal", permanent)
"copy-clipboard" ()
"selection-theatric" (shrink)
"delete-selection" () };
bind "braceright" { "begin-macro" ()
- "select-inner" ("{", "}", 0)
+ "select-inner" ("{", "}", 0, 0)
"set-mode" ("vim-normal", permanent)
"copy-clipboard" ()
"selection-theatric" (shrink)
"delete-selection" () };
bind "<shift>b" { "begin-macro" ()
- "select-inner" ("{", "}", 0)
+ "select-inner" ("{", "}", 0, 0)
"set-mode" ("vim-normal", permanent)
"copy-clipboard" ()
"selection-theatric" (shrink)
@@ -1382,14 +1382,14 @@
/* da< and da> */
bind "less" { "begin-macro" ()
- "select-inner" ("<", ">", 0)
+ "select-inner" ("<", ">", 0, 0)
"set-mode" ("vim-normal", permanent)
"copy-clipboard" ()
"selection-theatric" (shrink)
"delete-selection" () };
bind "greater" { "begin-macro" ()
- "select-inner" ("<", ">", 0)
+ "select-inner" ("<", ">", 0, 0)
"set-mode" ("vim-normal", permanent)
"copy-clipboard" ()
"selection-theatric" (shrink)
@@ -1679,46 +1679,46 @@
{
/* vi( , vi) , vib */
bind "parenleft" { "begin-macro" ()
- "select-inner" ("(", ")", 1)
+ "select-inner" ("(", ")", 1, 0)
"set-mode" ("vim-visual", permanent) };
bind "parenright" { "begin-macro" ()
- "select-inner" ("(", ")", 1)
+ "select-inner" ("(", ")", 1, 0)
"set-mode" ("vim-visual", permanent) };
bind "b" { "begin-macro" ()
- "select-inner" ("(", ")", 1)
+ "select-inner" ("(", ")", 1, 0)
"set-mode" ("vim-visual", permanent) };
/* vi[ and vi] */
bind "bracketleft" { "begin-macro" ()
- "select-inner" ("[", "]", 1)
+ "select-inner" ("[", "]", 1, 0)
"set-mode" ("vim-visual", permanent) };
bind "bracketright" { "begin-macro" ()
- "select-inner" ("[", "]", 1)
+ "select-inner" ("[", "]", 1, 0)
"set-mode" ("vim-visual", permanent) };
/* vi{ , vi} , viB */
bind "braceleft" { "begin-macro" ()
- "select-inner" ("{", "}", 1)
+ "select-inner" ("{", "}", 1, 0)
"set-mode" ("vim-visual", permanent) };
bind "braceright" { "begin-macro" ()
- "select-inner" ("{", "}", 1)
+ "select-inner" ("{", "}", 1, 0)
"set-mode" ("vim-visual", permanent) };
bind "<shift>b" { "begin-macro" ()
- "select-inner" ("{", "}", 1)
+ "select-inner" ("{", "}", 1, 0)
"set-mode" ("vim-visual", permanent) };
/* vi< and vi> */
bind "less" { "begin-macro" ()
- "select-inner" ("<", ">", 1)
+ "select-inner" ("<", ">", 1, 0)
"set-mode" ("vim-visual", permanent) };
bind "greater" { "begin-macro" ()
- "select-inner" ("<", ">", 1)
+ "select-inner" ("<", ">", 1, 0)
"set-mode" ("vim-visual", permanent) };
}
@@ -1726,46 +1726,46 @@
{
/* va( , va) , vab */
bind "parenleft" { "begin-macro" ()
- "select-inner" ("(", ")", 0)
+ "select-inner" ("(", ")", 0, 0)
"set-mode" ("vim-normal", permanent) };
bind "parenright" { "begin-macro" ()
- "select-inner" ("(", ")", 0)
+ "select-inner" ("(", ")", 0, 0)
"set-mode" ("vim-normal", permanent) };
bind "b" { "begin-macro" ()
- "select-inner" ("(", ")", 0)
+ "select-inner" ("(", ")", 0, 0)
"set-mode" ("vim-normal", permanent) };
/* va[ and va] */
bind "bracketleft" { "begin-macro" ()
- "select-inner" ("[", "]", 0)
+ "select-inner" ("[", "]", 0, 0)
"set-mode" ("vim-visual", permanent) };
bind "bracketright" { "begin-macro" ()
- "select-inner" ("[", "]", 0)
+ "select-inner" ("[", "]", 0, 0)
"set-mode" ("vim-visual", permanent) };
/* va{ , va} , vaB */
bind "braceleft" { "begin-macro" ()
- "select-inner" ("{", "}", 0)
+ "select-inner" ("{", "}", 0, 0)
"set-mode" ("vim-visual", permanent) };
bind "braceright" { "begin-macro" ()
- "select-inner" ("{", "}", 0)
+ "select-inner" ("{", "}", 0, 0)
"set-mode" ("vim-visual", permanent) };
bind "<shift>b" { "begin-macro" ()
- "select-inner" ("{", "}", 0)
+ "select-inner" ("{", "}", 0, 0)
"set-mode" ("vim-visual", permanent) };
/* va< and va> */
bind "less" { "begin-macro" ()
- "select-inner" ("<", ">", 0)
+ "select-inner" ("<", ">", 0, 0)
"set-mode" ("vim-visual", permanent) };
bind "greater" { "begin-macro" ()
- "select-inner" ("<", ">", 0)
+ "select-inner" ("<", ">", 0, 0)
"set-mode" ("vim-visual", permanent) };
}
diff --git a/libide/ide-source-view-movements.c b/libide/ide-source-view-movements.c
index 9c948ef..92b5aee 100644
--- a/libide/ide-source-view-movements.c
+++ b/libide/ide-source-view-movements.c
@@ -61,6 +61,7 @@ typedef struct
gunichar jump_from;
GtkDirectionType direction;
guint depth;
+ gboolean string_mode;
} MatchingBracketState;
static gboolean
@@ -780,7 +781,10 @@ bracket_predicate (gunichar ch,
{
MatchingBracketState *state = user_data;
- if (ch == state->jump_from)
+ if (ch == state->jump_from && state->string_mode && state->direction == GTK_DIR_LEFT)
+ return TRUE;
+
+ if (ch == state->jump_from && !state->string_mode)
state->depth += (state->direction == GTK_DIR_RIGHT) ? 1 : -1;
else if (ch == state->jump_to)
state->depth += (state->direction == GTK_DIR_RIGHT) ? -1 : 1;
@@ -796,22 +800,50 @@ match_char_with_depth (GtkTextIter *iter,
gunichar right_char,
GtkDirectionType direction,
gint depth,
- gboolean is_exclusive)
+ gboolean is_exclusive,
+ gboolean string_mode)
{
MatchingBracketState state;
+ GtkTextIter limit;
gboolean ret;
g_return_val_if_fail (direction == GTK_DIR_LEFT || direction == GTK_DIR_RIGHT, FALSE);
+ g_return_val_if_fail ((left_char == right_char && string_mode) ||
+ (left_char != right_char && !string_mode), FALSE);
state.jump_from = left_char;
state.jump_to = right_char;
state.direction = direction;
- state.depth = depth;
+ state.string_mode = string_mode;
+
+ /* We can't yet distinguish nested objects where left and right bounds are the same */
+ state.depth = (left_char == right_char) ? 1 : depth;
+
+ limit = *iter;
if (direction == GTK_DIR_LEFT)
- ret = gtk_text_iter_backward_find_char (iter, bracket_predicate, &state, NULL);
+ {
+ if (!gtk_text_iter_ends_line(iter) && gtk_text_iter_get_char (iter) != right_char)
+ gtk_text_iter_forward_char (iter);
+
+ if (string_mode)
+ {
+ gtk_text_iter_set_line_offset (&limit, 0);
+ ret = gtk_text_iter_backward_find_char (iter, bracket_predicate, &state, &limit);
+ }
+ else
+ ret = gtk_text_iter_backward_find_char (iter, bracket_predicate, &state, NULL);
+ }
else
- ret = gtk_text_iter_forward_find_char (iter, bracket_predicate, &state, NULL);
+ {
+ if (string_mode)
+ {
+ gtk_text_iter_forward_to_line_end (&limit);
+ ret = gtk_text_iter_forward_find_char (iter, bracket_predicate, &state, &limit);
+ }
+ else
+ ret = gtk_text_iter_forward_find_char (iter, bracket_predicate, &state, NULL);
+ }
if (ret && !is_exclusive)
gtk_text_iter_forward_char (iter);
@@ -832,27 +864,27 @@ ide_source_view_movements_match_special (Movement *mv)
switch (start_char)
{
case '{':
- ret = match_char_with_depth (&mv->insert, '{', '}', GTK_DIR_RIGHT, 1, mv->exclusive);
+ ret = match_char_with_depth (&mv->insert, '{', '}', GTK_DIR_RIGHT, 1, mv->exclusive, 0);
break;
case '[':
- ret = match_char_with_depth (&mv->insert, '[', ']', GTK_DIR_RIGHT, 1, mv->exclusive);
+ ret = match_char_with_depth (&mv->insert, '[', ']', GTK_DIR_RIGHT, 1, mv->exclusive, 0);
break;
case '(':
- ret = match_char_with_depth (&mv->insert, '(', ')', GTK_DIR_RIGHT, 1, mv->exclusive);
+ ret = match_char_with_depth (&mv->insert, '(', ')', GTK_DIR_RIGHT, 1, mv->exclusive, 0);
break;
case '}':
- ret = match_char_with_depth (&mv->insert, '{', '}', GTK_DIR_LEFT, 1, mv->exclusive);
+ ret = match_char_with_depth (&mv->insert, '{', '}', GTK_DIR_LEFT, 1, mv->exclusive, 0);
break;
case ']':
- ret = match_char_with_depth (&mv->insert, '[', ']', GTK_DIR_LEFT, 1, mv->exclusive);
+ ret = match_char_with_depth (&mv->insert, '[', ']', GTK_DIR_LEFT, 1, mv->exclusive, 0);
break;
case ')':
- ret = match_char_with_depth (&mv->insert, '(', ')', GTK_DIR_LEFT, 1, mv->exclusive);
+ ret = match_char_with_depth (&mv->insert, '(', ')', GTK_DIR_LEFT, 1, mv->exclusive, 0);
break;
default:
@@ -1638,28 +1670,53 @@ _ide_source_view_select_inner (IdeSourceView *self,
gunichar inner_left,
gunichar inner_right,
guint count,
- gboolean exclusive)
+ gboolean exclusive,
+ gboolean string_mode)
{
GtkTextBuffer *buffer;
GtkTextMark *insert;
+ GtkTextMark *selection;
GtkTextIter start;
GtkTextIter end;
+ GtkTextIter selection_iter;
+ gboolean ret;
g_return_if_fail (IDE_IS_SOURCE_VIEW (self));
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (self));
insert = gtk_text_buffer_get_insert (buffer);
gtk_text_buffer_get_iter_at_mark (buffer, &start, insert);
+ selection = gtk_text_buffer_get_selection_bound (buffer);
+ gtk_text_buffer_get_iter_at_mark (buffer, &selection_iter, selection);
+
+ /* Visual mode start with a selection length of 1. We use the left bound in this case */
+ if ((gtk_text_iter_get_offset (&start) - gtk_text_iter_get_offset (&selection_iter)) == 1)
+ gtk_text_iter_backward_char (&start);
+
+ if (string_mode)
+ {
+ if (gtk_text_iter_ends_line (&start))
+ return;
+
+ count = 1;
+ inner_right = inner_left;
+ }
+ else
+ {
+ count = MAX (1, count);
+ }
- count = MAX (1, count);
+ ret = match_char_with_depth (&start, inner_left, inner_right, GTK_DIR_LEFT, count, !exclusive,
string_mode);
+ if (!ret && string_mode)
+ ret = match_char_with_depth (&start, inner_left, inner_right, GTK_DIR_RIGHT, count, !exclusive,
string_mode);
- if (match_char_with_depth (&start, inner_left, inner_right, GTK_DIR_LEFT, count, !exclusive))
+ if (ret)
{
end = start;
if (exclusive)
gtk_text_iter_backward_char (&end);
- if (match_char_with_depth (&end, inner_left, inner_right, GTK_DIR_RIGHT, 1, exclusive))
+ if (match_char_with_depth (&end, inner_left, inner_right, GTK_DIR_RIGHT, 1, exclusive, string_mode))
{
gtk_text_buffer_select_range (buffer, &start, &end);
gtk_text_view_scroll_mark_onscreen (GTK_TEXT_VIEW (self), insert);
diff --git a/libide/ide-source-view-movements.h b/libide/ide-source-view-movements.h
index 72a7dc4..0024957 100644
--- a/libide/ide-source-view-movements.h
+++ b/libide/ide-source-view-movements.h
@@ -37,7 +37,8 @@ void _ide_source_view_select_inner (IdeSourceView *self,
gunichar inner_left,
gunichar inner_right,
guint count,
- gboolean exclusive);
+ gboolean exclusive,
+ gboolean string_mode);
G_END_DECLS
diff --git a/libide/ide-source-view.c b/libide/ide-source-view.c
index ae52b62..7847f08 100644
--- a/libide/ide-source-view.c
+++ b/libide/ide-source-view.c
@@ -3446,11 +3446,16 @@ ide_source_view_real_save_search_char (IdeSourceView *self)
priv->search_char = priv->modifier;
}
+/* In string mode, the search act only on the current line,
+ * search a string to the right if we are not already in one,
+ * and only inner_left is used ( inner_right is set to it )
+ */
static void
ide_source_view_real_select_inner (IdeSourceView *self,
const gchar *inner_left,
const gchar *inner_right,
- gboolean exclusive)
+ gboolean exclusive,
+ gboolean string_mode)
{
IdeSourceViewPrivate *priv = ide_source_view_get_instance_private (self);
gunichar unichar_inner_left;
@@ -3465,7 +3470,8 @@ ide_source_view_real_select_inner (IdeSourceView *self,
unichar_inner_left,
unichar_inner_right,
priv->count,
- exclusive);
+ exclusive,
+ string_mode);
}
static void
@@ -6038,9 +6044,10 @@ ide_source_view_class_init (IdeSourceViewClass *klass)
G_STRUCT_OFFSET (IdeSourceViewClass, select_inner),
NULL, NULL, NULL,
G_TYPE_NONE,
- 3,
+ 4,
G_TYPE_STRING,
G_TYPE_STRING,
+ G_TYPE_BOOLEAN,
G_TYPE_BOOLEAN);
signals [SELECTION_THEATRIC] =
diff --git a/libide/ide-source-view.h b/libide/ide-source-view.h
index e6d0b50..dfb874c 100644
--- a/libide/ide-source-view.h
+++ b/libide/ide-source-view.h
@@ -262,7 +262,8 @@ struct _IdeSourceViewClass
void (*select_inner) (IdeSourceView *self,
const gchar *inner_left,
const gchar *inner_right,
- gboolean exclusive);
+ gboolean exclusive,
+ gboolean string_mode);
void (*selection_theatric) (IdeSourceView *self,
IdeSourceViewTheatric theatric);
void (*set_mode) (IdeSourceView *self,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]