Skip to content

Commit 77557a7

Browse files
committed
patch 8.0.1674: libvterm can't handle an OSC string split
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.
1 parent 4791015 commit 77557a7

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

src/libvterm/src/parser.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,11 @@ size_t vterm_input_write(VTerm *vt, const char *bytes, size_t len)
288288
done_string(vt, string_start, bytes + pos - string_start);
289289
ENTER_NORMAL_STATE();
290290
}
291+
else if (pos + 1 == len) {
292+
/* end of input but OSC string isn't finished yet, copy it to
293+
* vt->parser.strbuffer to continue it later */
294+
more_string(vt, string_start, bytes + pos + 1 - string_start);
295+
}
291296
break;
292297

293298
case NORMAL:

src/libvterm/src/vterm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ VTerm *vterm_new_with_allocator(int rows, int cols, VTermAllocatorFunctions *fun
5252
vt->parser.callbacks = NULL;
5353
vt->parser.cbdata = NULL;
5454

55-
vt->parser.strbuffer_len = 64;
55+
vt->parser.strbuffer_len = 500; /* should be able to hold an OSC string */
5656
vt->parser.strbuffer_cur = 0;
5757
vt->parser.strbuffer = vterm_allocator_malloc(vt, vt->parser.strbuffer_len);
5858

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -762,6 +762,8 @@ static char *(features[]) =
762762

763763
static int included_patches[] =
764764
{ /* Add new patch number below this line */
765+
/**/
766+
1674,
765767
/**/
766768
1673,
767769
/**/

0 commit comments

Comments
 (0)