[gtksourceview/wip/chergert/vim: 358/363] some basic insert test
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview/wip/chergert/vim: 358/363] some basic insert test
- Date: Mon, 8 Nov 2021 19:53:56 +0000 (UTC)
commit 9929758cc2ebfde53fa986d691589d288b36d69c
Author: Christian Hergert <chergert redhat com>
Date: Sun Nov 7 13:04:27 2021 -0800
some basic insert test
testsuite/test-vim-input.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/testsuite/test-vim-input.c b/testsuite/test-vim-input.c
index 92a019fb..7d009025 100644
--- a/testsuite/test-vim-input.c
+++ b/testsuite/test-vim-input.c
@@ -47,7 +47,7 @@ run_test (const char *text,
{
GtkSourceVimState *current = gtk_source_vim_state_get_current (GTK_SOURCE_VIM_STATE (vim));
gunichar ch = g_utf8_get_char (c);
- char string[16];
+ char string[16] = {0};
GdkModifierType mods = 0;
guint keyval;
@@ -55,7 +55,7 @@ run_test (const char *text,
* the fact that our engine knows key-presses pretty much
* everywhere so that we can send keypresses based on chars.
*/
- g_unichar_to_utf8 (ch, string);
+ string[g_unichar_to_utf8 (ch, string)] = 0;
if (ch == '\e')
{
@@ -69,7 +69,10 @@ run_test (const char *text,
keyval = gdk_unicode_to_keyval (ch);
}
- GTK_SOURCE_VIM_STATE_GET_CLASS (current)->handle_keypress (current, keyval, 0, mods, string);
+ if (!GTK_SOURCE_VIM_STATE_GET_CLASS (current)->handle_keypress (current, keyval, 0, mods,
string))
+ {
+ gtk_text_buffer_insert_at_cursor (GTK_TEXT_BUFFER (buffer), string, -1);
+ }
}
gtk_text_buffer_get_bounds (GTK_TEXT_BUFFER (buffer), &begin, &end);
@@ -95,6 +98,7 @@ test_motion (void)
run_test ("line1\n\n", "dj", "");
run_test ("1\n2\n", "d2j", "");
run_test ("1\n2\n", "d10j", "");
+ run_test ("", "itesting\ea this.\e", "testing this.");
}
int
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]