[gtksourceview/wip/chergert/vim: 209/293] add escape hatch for register buffer sizes




commit 8a4310bc6de9ac5557c3e65aa915590f65db5296
Author: Christian Hergert <chergert redhat com>
Date:   Tue Nov 2 12:16:55 2021 -0700

    add escape hatch for register buffer sizes

 gtksourceview/vim/gtk-source-vim-registers.c | 7 +++++++
 1 file changed, 7 insertions(+)
---
diff --git a/gtksourceview/vim/gtk-source-vim-registers.c b/gtksourceview/vim/gtk-source-vim-registers.c
index 5e383d50..38b667a0 100644
--- a/gtksourceview/vim/gtk-source-vim-registers.c
+++ b/gtksourceview/vim/gtk-source-vim-registers.c
@@ -24,6 +24,7 @@
 #include "gtk-source-vim-registers.h"
 
 #define DEFAULT_REGISTER "\""
+#define MAX_BYTES (4096L*16L) /* 64kb */
 
 struct _GtkSourceVimRegisters
 {
@@ -97,6 +98,12 @@ gtk_source_vim_registers_take (GtkSourceVimRegisters *self,
                name = DEFAULT_REGISTER;
        }
 
+       /* TODO: Allow :set viminfo to tweak register lines, bytes, etc */
+       if (value != NULL && strlen (value) > MAX_BYTES)
+       {
+               value = NULL;
+       }
+
        if (value == NULL)
                g_hash_table_remove (self->values, name);
        else


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