[gtksourceview] vim: avoid inclusivity unless selection is present
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview] vim: avoid inclusivity unless selection is present
- Date: Tue, 23 Nov 2021 15:22:33 +0000 (UTC)
commit 50e2ef6510b341f44a4a41cf42baee742e74bfd7
Author: Christian Hergert <chergert redhat com>
Date: Tue Nov 23 09:18:46 2021 -0600
vim: avoid inclusivity unless selection is present
This fixes a situation like 4I at position 0 due to inclusivity of the
first-char motion. We only need to apply inclusivity when we are applying
a change (which implies a selection motion).
gtksourceview/vim/gtksourceviminsert.c | 2 +-
testsuite/test-vim-input.c | 2 ++
2 files changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/gtksourceview/vim/gtksourceviminsert.c b/gtksourceview/vim/gtksourceviminsert.c
index 0d90a658..57c4cf31 100644
--- a/gtksourceview/vim/gtksourceviminsert.c
+++ b/gtksourceview/vim/gtksourceviminsert.c
@@ -205,7 +205,7 @@ gtk_source_vim_insert_prepare (GtkSourceVimInsert *self)
{
if (self->motion)
{
- gtk_source_vim_motion_apply (self->motion, &iter, TRUE);
+ gtk_source_vim_motion_apply (self->motion, &iter, self->selection_motion != NULL);
if (self->at == GTK_SOURCE_VIM_INSERT_AFTER_CHAR ||
self->at == GTK_SOURCE_VIM_INSERT_AFTER_CHAR_UNLESS_BOF)
diff --git a/testsuite/test-vim-input.c b/testsuite/test-vim-input.c
index 1fa62088..c0ae334d 100644
--- a/testsuite/test-vim-input.c
+++ b/testsuite/test-vim-input.c
@@ -106,12 +106,14 @@ test_insert (void)
run_test ("line1", "O\e", "\nline1");
run_test ("", "itesting\ea this.\e", "testing this.");
run_test ("", "3iz\e", "zzz");
+ run_test ("\tPROP_0,\n", "3IPROP\e", "\tPROPPROPPROPPROP_0,\n");
}
static void
test_change (void)
{
run_test ("word here", "ciwnot\e", "not here");
+ run_test ("word here", "wc$\e", "word ");
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]