[gtksourceview/wip/chergert/fix-190: 2/2] view: fix move-words when boundaries are juxtapose
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview/wip/chergert/fix-190: 2/2] view: fix move-words when boundaries are juxtapose
- Date: Wed, 28 Jul 2021 22:10:26 +0000 (UTC)
commit 236aed4fd2d5819bee7821258abc85a0f46d9989
Author: Christian Hergert <chergert redhat com>
Date: Wed Jul 28 15:09:02 2021 -0700
view: fix move-words when boundaries are juxtapose
If we have words to move that are right next to each other, then we need
to special case our boundary checks as well as our mark gravity so they
do not move when deleting/inserting words.
Fixes #190
gtksourceview/gtksourceview.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/gtksourceview/gtksourceview.c b/gtksourceview/gtksourceview.c
index 9fd57394..3bbd676c 100644
--- a/gtksourceview/gtksourceview.c
+++ b/gtksourceview/gtksourceview.c
@@ -3673,7 +3673,8 @@ gtk_source_view_move_words (GtkSourceView *view,
}
if (gtk_text_iter_in_range (&ns, &s, &e) ||
- gtk_text_iter_in_range (&ne, &s, &e))
+ (!gtk_text_iter_equal (&s, &ne) &&
+ gtk_text_iter_in_range (&ne, &s, &e)))
{
return;
}
@@ -3683,8 +3684,8 @@ gtk_source_view_move_words (GtkSourceView *view,
gtk_text_buffer_begin_user_action (buf);
- nsmark = gtk_text_buffer_create_mark (buf, NULL, &ns, TRUE);
- nemark = gtk_text_buffer_create_mark (buf, NULL, &ne, FALSE);
+ nsmark = gtk_text_buffer_create_mark (buf, NULL, &ns, step < 0);
+ nemark = gtk_text_buffer_create_mark (buf, NULL, &ne, step < 0);
gtk_text_buffer_delete (buf, &s, &e);
gtk_text_buffer_insert (buf, &s, new_text, -1);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]