]> granicus.if.org Git - vim/commitdiff
patch 8.0.1674: libvterm can't handle an OSC string split v8.0.1674
authorBram Moolenaar <Bram@vim.org>
Sat, 7 Apr 2018 19:42:56 +0000 (21:42 +0200)
committerBram Moolenaar <Bram@vim.org>
Sat, 7 Apr 2018 19:42:56 +0000 (21:42 +0200)
Problem:    Libvterm can't handle a long OSC string that is split.
Solution:   When an incomplete OSC string is received copy it to the parser
            buffer. Increase the size of the parser buffer to be able to
            handle longer strings.

src/libvterm/src/parser.c
src/libvterm/src/vterm.c
src/version.c

index c71ea8d736335bedae65d23b8b80c65818b289a8..b07bb94a23a4809e8616b7fb2408bc326a3e8075 100644 (file)
@@ -288,6 +288,11 @@ size_t vterm_input_write(VTerm *vt, const char *bytes, size_t len)
         done_string(vt, string_start, bytes + pos - string_start);
         ENTER_NORMAL_STATE();
       }
+      else if (pos + 1 == len) {
+       /* end of input but OSC string isn't finished yet, copy it to
+        * vt->parser.strbuffer to continue it later */
+        more_string(vt, string_start, bytes + pos + 1 - string_start);
+      }
       break;
 
     case NORMAL:
index d9f0e208db3d3a7ed7a8bc2d6f0727a9ed78eda1..f066b01b810d884b55159f12a7e86dae1af31860 100644 (file)
@@ -52,7 +52,7 @@ VTerm *vterm_new_with_allocator(int rows, int cols, VTermAllocatorFunctions *fun
   vt->parser.callbacks = NULL;
   vt->parser.cbdata    = NULL;
 
-  vt->parser.strbuffer_len = 64;
+  vt->parser.strbuffer_len = 500; /* should be able to hold an OSC string */
   vt->parser.strbuffer_cur = 0;
   vt->parser.strbuffer = vterm_allocator_malloc(vt, vt->parser.strbuffer_len);
 
index 9f065797c50a2af12bbb98719b71dea7871ad1fd..e95a62d3d3b73c52a7c88e0b57f56d1fce83447a 100644 (file)
@@ -762,6 +762,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1674,
 /**/
     1673,
 /**/