[gtksourceview/wip/chergert/vim] escape better



commit 873eba19cc5ad0863087a6594689ba62025005f7
Author: Christian Hergert <chergert redhat com>
Date:   Thu Oct 28 10:12:14 2021 -0700

    escape better

 gtksourceview/gtksourcevimimcontext.c    | 6 ++++--
 gtksourceview/vim/gtk-source-vim-state.c | 7 +++++--
 2 files changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/gtksourceview/gtksourcevimimcontext.c b/gtksourceview/gtksourcevimimcontext.c
index f19fae22..94b9539b 100644
--- a/gtksourceview/gtksourcevimimcontext.c
+++ b/gtksourceview/gtksourcevimimcontext.c
@@ -73,13 +73,15 @@ keyval_to_string (guint           keyval,
 
                case GDK_KEY_ISO_Left_Tab:
                case GDK_KEY_Tab:
-                       str[pos++] = '\t';
+                       str[pos++] = '\\';
+                       str[pos++] = 't';
                        break;
 
                case GDK_KEY_Return:
                case GDK_KEY_KP_Enter:
                case GDK_KEY_ISO_Enter:
-                       str[pos++] = '\n';
+                       str[pos++] = '\\';
+                       str[pos++] = 'n';
                        break;
 
                default:
diff --git a/gtksourceview/vim/gtk-source-vim-state.c b/gtksourceview/vim/gtk-source-vim-state.c
index 9228d698..367af5ef 100644
--- a/gtksourceview/vim/gtk-source-vim-state.c
+++ b/gtksourceview/vim/gtk-source-vim-state.c
@@ -61,18 +61,21 @@ keyval_to_string (guint           keyval,
        switch (keyval)
        {
                case GDK_KEY_Escape:
+                       str[pos++] = '^';
                        str[pos++] = '[';
                        break;
 
                case GDK_KEY_ISO_Left_Tab:
                case GDK_KEY_Tab:
-                       str[pos++] = '\t';
+                       str[pos++] = '\\';
+                       str[pos++] = 't';
                        break;
 
                case GDK_KEY_Return:
                case GDK_KEY_KP_Enter:
                case GDK_KEY_ISO_Enter:
-                       str[pos++] = '\n';
+                       str[pos++] = '\\';
+                       str[pos++] = 'n';
                        break;
 
                default:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]