[gtksourceview/wip/chergert/vim: 295/363] fix empty line w/ word
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview/wip/chergert/vim: 295/363] fix empty line w/ word
- Date: Mon, 8 Nov 2021 19:53:54 +0000 (UTC)
commit 6543eee87ce004032fe37d16cabb09706283eee8
Author: Christian Hergert <chergert redhat com>
Date: Thu Nov 4 22:47:10 2021 -0700
fix empty line w/ word
gtksourceview/vim/gtk-source-vim-text-object.c | 5 ++++-
testsuite/test-vim-text-object.c | 1 +
2 files changed, 5 insertions(+), 1 deletion(-)
---
diff --git a/gtksourceview/vim/gtk-source-vim-text-object.c b/gtksourceview/vim/gtk-source-vim-text-object.c
index f9f1d0ac..29ea3f97 100644
--- a/gtksourceview/vim/gtk-source-vim-text-object.c
+++ b/gtksourceview/vim/gtk-source-vim-text-object.c
@@ -98,7 +98,10 @@ text_object_extend_word (const GtkTextIter *origin,
GtkTextIter *a_begin,
GtkTextIter *a_end)
{
- gtk_text_iter_forward_char (inner_end);
+ if (!gtk_text_iter_ends_line (inner_end))
+ {
+ gtk_text_iter_forward_char (inner_end);
+ }
if (gtk_text_iter_compare (origin, inner_begin) < 0)
{
diff --git a/testsuite/test-vim-text-object.c b/testsuite/test-vim-text-object.c
index 04988b31..a9ed32b9 100644
--- a/testsuite/test-vim-text-object.c
+++ b/testsuite/test-vim-text-object.c
@@ -84,6 +84,7 @@ test_word (void)
run_test (gtk_source_vim_text_object_new_a_word (), "+ -", 1, " -", FALSE);
run_test (gtk_source_vim_text_object_new_a_word (), "a b", 2, "b", FALSE);
run_test (gtk_source_vim_text_object_new_a_word (), "a b c", 2, "b ", FALSE);
+ run_test (gtk_source_vim_text_object_new_inner_word (), "\n \n\n", 2, " ", FALSE);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]