[gtksourceview/wip/chergert/vim] improve paragaph text object
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview/wip/chergert/vim] improve paragaph text object
- Date: Fri, 5 Nov 2021 21:25:09 +0000 (UTC)
commit fd825aadcc3ff8dcfd3b5eeeed6bf3cf5e7fbc88
Author: Christian Hergert <chergert redhat com>
Date: Fri Nov 5 14:19:26 2021 -0700
improve paragaph text object
gtksourceview/vim/gtk-source-vim-text-object.c | 7 +++++++
testsuite/test-vim-text-object.c | 2 ++
2 files changed, 9 insertions(+)
---
diff --git a/gtksourceview/vim/gtk-source-vim-text-object.c b/gtksourceview/vim/gtk-source-vim-text-object.c
index e80ed4a9..a49a4a69 100644
--- a/gtksourceview/vim/gtk-source-vim-text-object.c
+++ b/gtksourceview/vim/gtk-source-vim-text-object.c
@@ -182,7 +182,14 @@ gtk_source_vim_iter__backward_paragraph_start (GtkTextIter *iter)
{
if (gtk_text_iter_is_start (iter))
return TRUE;
+
gtk_text_iter_backward_line (iter);
+
+ if (is_empty_line (iter))
+ {
+ gtk_text_iter_forward_char (iter);
+ break;
+ }
}
return TRUE;
diff --git a/testsuite/test-vim-text-object.c b/testsuite/test-vim-text-object.c
index 8dcfc9b7..a876e61d 100644
--- a/testsuite/test-vim-text-object.c
+++ b/testsuite/test-vim-text-object.c
@@ -189,6 +189,7 @@ test_paragraph (void)
run_test (gtk_source_vim_text_object_new_inner_paragraph (), "\n\n", 1, "\n\n");
run_test (gtk_source_vim_text_object_new_inner_paragraph (), "\n\n\n", 1, "\n\n\n");
run_test (gtk_source_vim_text_object_new_inner_paragraph (), "what\nwill\n we\n\nfind\nhere.", 1,
"what\nwill\n we");
+ run_test (gtk_source_vim_text_object_new_inner_paragraph (), "\tword;\n\n\tanother;\n\n\tthird;\n",
9, "\tanother;");
run_test (gtk_source_vim_text_object_new_a_paragraph (), "testing this.\n\n\n", 0, "testing
this.\n\n\n");
run_test (gtk_source_vim_text_object_new_a_paragraph (), "testing this.\n", 5, "testing this.\n");
@@ -196,6 +197,7 @@ test_paragraph (void)
run_test (gtk_source_vim_text_object_new_a_paragraph (), "\n\n", 1, "\n\n");
run_test (gtk_source_vim_text_object_new_a_paragraph (), "\n\n\n", 1, "\n\n\n");
run_test (gtk_source_vim_text_object_new_a_paragraph (), "what\nwill\n we\n\nfind\nhere.", 1,
"what\nwill\n we\n");
+ run_test (gtk_source_vim_text_object_new_a_paragraph (), "\tword;\n\n\tanother;\n\n\tthird;\n", 9,
"\tanother;\n");
}
int
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]