• R/O
  • SSH

vim: Commit

Mirror of the Vim source from https://github.com/vim/vim


Commit MetaInfo

Revisiona4652d7ec99f0ea9e9455dea30288961fa0f6f58 (tree)
Time2020-05-23 05:15:04
AuthorBram Moolenaar <Bram@vim....>
CommiterBram Moolenaar

Log Message

patch 8.2.0813: libvterm code is slightly different from upstream

Commit: https://github.com/vim/vim/commit/591cec8366e87a172495c362477cbf5de8d399f0
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri May 22 22:06:06 2020 +0200

patch 8.2.0813: libvterm code is slightly different from upstream
Problem: libvterm code is slightly different from upstream.
Solution: Use upstream text to avoid future merge problems. Mainly comment
style changes.

Change Summary

Incremental Difference

diff -r a7c6cd0d7ba0 -r a4652d7ec99f src/libvterm/include/vterm.h
--- a/src/libvterm/include/vterm.h Fri May 22 20:15:04 2020 +0200
+++ b/src/libvterm/include/vterm.h Fri May 22 22:15:04 2020 +0200
@@ -35,9 +35,7 @@
3535 int col;
3636 } VTermPos;
3737
38-/*
39- * Some small utility functions; we can just keep these static here.
40- */
38+/* some small utility functions; we can just keep these static here */
4139
4240 /*
4341 * Order points by on-screen flow order:
@@ -62,7 +60,7 @@
6260 int end_col;
6361 } VTermRect;
6462
65-// Return true if the rect "r" contains the point "p".
63+/* true if the rect contains the point */
6664 int vterm_rect_contains(VTermRect r, VTermPos p);
6765
6866 #if defined(DEFINE_INLINES) || USE_INLINE
@@ -73,6 +71,7 @@
7371 }
7472 #endif
7573
74+/* move a rect */
7675 // Move "rect" "row_delta" down and "col_delta" right.
7776 // Does not check boundaries.
7877 void vterm_rect_move(VTermRect *rect, int row_delta, int col_delta);
@@ -185,9 +184,8 @@
185184 */
186185 int vterm_color_is_equal(const VTermColor *a, const VTermColor *b);
187186
188-
189187 typedef enum {
190- // VTERM_VALUETYPE_NONE = 0
188+ /* VTERM_VALUETYPE_NONE = 0 */
191189 VTERM_VALUETYPE_BOOL = 1,
192190 VTERM_VALUETYPE_INT,
193191 VTERM_VALUETYPE_STRING,
@@ -211,7 +209,7 @@
211209 } VTermValue;
212210
213211 typedef enum {
214- // VTERM_ATTR_NONE = 0
212+ /* VTERM_ATTR_NONE = 0 */
215213 VTERM_ATTR_BOLD = 1, // bool: 1, 22
216214 VTERM_ATTR_UNDERLINE, // number: 4, 21, 24
217215 VTERM_ATTR_ITALIC, // bool: 3, 23
@@ -227,7 +225,7 @@
227225 } VTermAttr;
228226
229227 typedef enum {
230- // VTERM_PROP_NONE = 0
228+ /* VTERM_PROP_NONE = 0 */
231229 VTERM_PROP_CURSORVISIBLE = 1, // bool
232230 VTERM_PROP_CURSORBLINK, // bool
233231 VTERM_PROP_ALTSCREEN, // bool
@@ -261,9 +259,9 @@
261259 typedef struct {
262260 const uint32_t *chars;
263261 int width;
264- unsigned int protected_cell:1; // DECSCA-protected against DECSEL/DECSED
265- unsigned int dwl:1; // DECDWL or DECDHL double-width line
266- unsigned int dhl:2; // DECDHL double-height line (1=top 2=bottom)
262+ unsigned int protected_cell:1; /* DECSCA-protected against DECSEL/DECSED */
263+ unsigned int dwl:1; /* DECDWL or DECDHL double-width line */
264+ unsigned int dhl:2; /* DECDHL double-height line (1=top 2=bottom) */
267265 } VTermGlyphInfo;
268266
269267 typedef struct {
@@ -272,9 +270,18 @@
272270 unsigned int continuation:1; /* Line is a flow continuation of the previous */
273271 } VTermLineInfo;
274272
273+/* Copies of VTermState fields that the 'resize' callback might have reason to
274+ * edit. 'resize' callback gets total control of these fields and may
275+ * free-and-reallocate them if required. They will be copied back from the
276+ * struct after the callback has returned.
277+ */
275278 typedef struct {
276- // libvterm relies on the allocated memory to be zeroed out before it is
277- // returned by the allocator.
279+ VTermPos pos; /* current cursor position */
280+} VTermStateFields;
281+
282+typedef struct {
283+ /* libvterm relies on this memory to be zeroed out before it is returned
284+ * by the allocator. */
278285 void *(*malloc)(size_t size, void *allocdata);
279286 void (*free)(void *ptr, void *allocdata);
280287 } VTermAllocatorFunctions;
@@ -329,20 +336,21 @@
329336 // Parser layer
330337 // ------------
331338
332-// Flag to indicate non-final subparameters in a single CSI parameter.
333-// Consider
334-// CSI 1;2:3:4;5a
335-// 1 4 and 5 are final.
336-// 2 and 3 are non-final and will have this bit set
337-//
338-// Don't confuse this with the final byte of the CSI escape; 'a' in this case.
339+/* Flag to indicate non-final subparameters in a single CSI parameter.
340+ * Consider
341+ * CSI 1;2:3:4;5a
342+ * 1 4 and 5 are final.
343+ * 2 and 3 are non-final and will have this bit set
344+ *
345+ * Don't confuse this with the final byte of the CSI escape; 'a' in this case.
346+ */
339347 #define CSI_ARG_FLAG_MORE (1U<<31)
340348 #define CSI_ARG_MASK (~(1U<<31))
341349
342350 #define CSI_ARG_HAS_MORE(a) ((a) & CSI_ARG_FLAG_MORE)
343351 #define CSI_ARG(a) ((a) & CSI_ARG_MASK)
344352
345-// Can't use -1 to indicate a missing argument; use this instead
353+/* Can't use -1 to indicate a missing argument; use this instead */
346354 #define CSI_ARG_MISSING ((1<<30)-1)
347355
348356 #define CSI_ARG_IS_MISSING(a) (CSI_ARG(a) == CSI_ARG_MISSING)
@@ -366,15 +374,6 @@
366374 // State layer
367375 // -----------
368376
369-/* Copies of VTermState fields that the 'resize' callback might have reason to
370- * edit. 'resize' callback gets total control of these fields and may
371- * free-and-reallocate them if required. They will be copied back from the
372- * struct after the callback has returned.
373- */
374-typedef struct {
375- VTermPos pos; /* current cursor position */
376-} VTermStateFields;
377-
378377 typedef struct {
379378 int (*putglyph)(VTermGlyphInfo *info, VTermPos pos, void *user);
380379 int (*movecursor)(VTermPos pos, VTermPos oldpos, int visible, void *user);
@@ -459,9 +458,9 @@
459458 unsigned int reverse : 1;
460459 unsigned int conceal : 1;
461460 unsigned int strike : 1;
462- unsigned int font : 4; // 0 to 9
463- unsigned int dwl : 1; // On a DECDWL or DECDHL line
464- unsigned int dhl : 2; // On a DECDHL line (1=top 2=bottom)
461+ unsigned int font : 4; /* 0 to 9 */
462+ unsigned int dwl : 1; /* On a DECDWL or DECDHL line */
463+ unsigned int dhl : 2; /* On a DECDHL line (1=top 2=bottom) */
465464 } VTermScreenCellAttrs;
466465
467466 enum {
@@ -513,10 +512,10 @@
513512 void vterm_screen_enable_altscreen(VTermScreen *screen, int altscreen);
514513
515514 typedef enum {
516- VTERM_DAMAGE_CELL, // every cell
517- VTERM_DAMAGE_ROW, // entire rows
518- VTERM_DAMAGE_SCREEN, // entire screen
519- VTERM_DAMAGE_SCROLL, // entire screen + scrollrect
515+ VTERM_DAMAGE_CELL, /* every cell */
516+ VTERM_DAMAGE_ROW, /* entire rows */
517+ VTERM_DAMAGE_SCREEN, /* entire screen */
518+ VTERM_DAMAGE_SCROLL, /* entire screen + scrollrect */
520519
521520 VTERM_N_DAMAGES
522521 } VTermDamageSize;
@@ -532,7 +531,7 @@
532531 */
533532 void vterm_screen_reset(VTermScreen *screen, int hard);
534533
535-// Neither of these functions NUL-terminate the buffer
534+/* Neither of these functions NUL-terminate the buffer */
536535 size_t vterm_screen_get_chars(const VTermScreen *screen, uint32_t *chars, size_t len, const VTermRect rect);
537536 size_t vterm_screen_get_text(const VTermScreen *screen, char *str, size_t len, const VTermRect rect);
538537
diff -r a7c6cd0d7ba0 -r a4652d7ec99f src/libvterm/src/encoding.c
--- a/src/libvterm/src/encoding.c Fri May 22 20:15:04 2020 +0200
+++ b/src/libvterm/src/encoding.c Fri May 22 22:15:04 2020 +0200
@@ -223,7 +223,7 @@
223223 { 0, 0, NULL },
224224 };
225225
226-// This ought to be INTERNAL but isn't because it's used by unit testing
226+/* This ought to be INTERNAL but isn't because it's used by unit testing */
227227 VTermEncoding *vterm_lookup_encoding(VTermEncodingType type, char designation)
228228 {
229229 int i;
diff -r a7c6cd0d7ba0 -r a4652d7ec99f src/libvterm/src/keyboard.c
--- a/src/libvterm/src/keyboard.c Fri May 22 20:15:04 2020 +0200
+++ b/src/libvterm/src/keyboard.c Fri May 22 22:15:04 2020 +0200
@@ -19,8 +19,9 @@
1919 return;
2020 }
2121
22- // The shift modifier is never important for Unicode characters
23- // apart from Space
22+ /* The shift modifier is never important for Unicode characters
23+ * apart from Space
24+ */
2425 if(c != ' ')
2526 mod &= ~VTERM_MOD_SHIFT;
2627
@@ -33,24 +34,24 @@
3334 }
3435
3536 switch(c) {
36- // Special Ctrl- letters that can't be represented elsewise
37+ /* Special Ctrl- letters that can't be represented elsewise */
3738 case 'i': case 'j': case 'm': case '[':
3839 needs_CSIu = 1;
3940 break;
40- // Ctrl-\ ] ^ _ don't need CSUu
41+ /* Ctrl-\ ] ^ _ don't need CSUu */
4142 case '\\': case ']': case '^': case '_':
4243 needs_CSIu = 0;
4344 break;
44- // Shift-space needs CSIu
45+ /* Shift-space needs CSIu */
4546 case ' ':
4647 needs_CSIu = !!(mod & VTERM_MOD_SHIFT);
4748 break;
48- // All other characters needs CSIu except for letters a-z
49+ /* All other characters needs CSIu except for letters a-z */
4950 default:
5051 needs_CSIu = (c < 'a' || c > 'z');
5152 }
5253
53- // ALT we can just prefix with ESC; anything else requires CSI u
54+ /* ALT we can just prefix with ESC; anything else requires CSI u */
5455 if(needs_CSIu && (mod & ~VTERM_MOD_ALT)) {
5556 vterm_push_output_sprintf_ctrl(vt, C1_CSI, "%d;%du", c, mod+1);
5657 return;
@@ -165,7 +166,7 @@
165166 break;
166167
167168 case KEYCODE_TAB:
168- // Shift-Tab is CSI Z but plain Tab is 0x09
169+ /* Shift-Tab is CSI Z but plain Tab is 0x09 */
169170 if(mod == VTERM_MOD_SHIFT)
170171 vterm_push_output_sprintf_ctrl(vt, C1_CSI, "Z");
171172 else if(mod & VTERM_MOD_SHIFT)
@@ -175,7 +176,7 @@
175176 break;
176177
177178 case KEYCODE_ENTER:
178- // Enter is CRLF in newline mode, but just LF in linefeed
179+ /* Enter is CRLF in newline mode, but just LF in linefeed */
179180 if(vt->state->mode.newline)
180181 vterm_push_output_sprintf(vt, "\r\n");
181182 else
diff -r a7c6cd0d7ba0 -r a4652d7ec99f src/libvterm/src/mouse.c
--- a/src/libvterm/src/mouse.c Fri May 22 20:15:04 2020 +0200
+++ b/src/libvterm/src/mouse.c Fri May 22 22:15:04 2020 +0200
@@ -83,7 +83,7 @@
8383 state->mouse_buttons &= ~(1 << (button-1));
8484 }
8585
86- // Most of the time we don't get button releases from 4/5
86+ /* Most of the time we don't get button releases from 4/5 */
8787 if(state->mouse_buttons == old_buttons && button < 4)
8888 return;
8989 if (!(state->mouse_flags & MOUSE_WANT_CLICK))
diff -r a7c6cd0d7ba0 -r a4652d7ec99f src/libvterm/src/parser.c
--- a/src/libvterm/src/parser.c Fri May 22 20:15:04 2020 +0200
+++ b/src/libvterm/src/parser.c Fri May 22 22:15:04 2020 +0200
@@ -34,7 +34,7 @@
3434
3535 if(vt->parser.callbacks && vt->parser.callbacks->csi)
3636 if((*vt->parser.callbacks->csi)(
37- vt->parser.v.csi.leaderlen ? vt->parser.v.csi.leader : NULL,
37+ vt->parser.v.csi.leaderlen ? vt->parser.v.csi.leader : NULL,
3838 vt->parser.v.csi.args,
3939 vt->parser.v.csi.argi,
4040 vt->parser.intermedlen ? vt->parser.intermed : NULL,
@@ -187,23 +187,23 @@
187187
188188 switch(vt->parser.state) {
189189 case CSI_LEADER:
190- // Extract leader bytes 0x3c to 0x3f
190+ /* Extract leader bytes 0x3c to 0x3f */
191191 if(c >= 0x3c && c <= 0x3f) {
192192 if(vt->parser.v.csi.leaderlen < CSI_LEADER_MAX-1)
193193 vt->parser.v.csi.leader[vt->parser.v.csi.leaderlen++] = c;
194194 break;
195195 }
196196
197- // else fallthrough
197+ /* else fallthrough */
198198 vt->parser.v.csi.leader[vt->parser.v.csi.leaderlen] = 0;
199199
200200 vt->parser.v.csi.argi = 0;
201201 vt->parser.v.csi.args[0] = CSI_ARG_MISSING;
202202 vt->parser.state = CSI_ARGS;
203203
204- // fallthrough
204+ /* fallthrough */
205205 case CSI_ARGS:
206- // Numerical value of argument
206+ /* Numerical value of argument */
207207 if(c >= '0' && c <= '9') {
208208 if(vt->parser.v.csi.args[vt->parser.v.csi.argi] == CSI_ARG_MISSING)
209209 vt->parser.v.csi.args[vt->parser.v.csi.argi] = 0;
@@ -221,7 +221,7 @@
221221 break;
222222 }
223223
224- // else fallthrough
224+ /* else fallthrough */
225225 vt->parser.v.csi.argi++;
226226 vt->parser.intermedlen = 0;
227227 vt->parser.state = CSI_INTERMED;
@@ -233,13 +233,13 @@
233233 break;
234234 }
235235 else if(c == 0x1b) {
236- // ESC in CSI cancels
236+ /* ESC in CSI cancels */
237237 }
238238 else if(c >= 0x40 && c <= 0x7e) {
239239 vt->parser.intermed[vt->parser.intermedlen] = 0;
240240 do_csi(vt, c);
241241 }
242- // else was invalid CSI
242+ /* else was invalid CSI */
243243
244244 ENTER_NORMAL_STATE();
245245 break;
@@ -330,7 +330,7 @@
330330
331331 if(!eaten) {
332332 DEBUG_LOG("libvterm: Text callback did not consume any input\n");
333- // force it to make progress
333+ /* force it to make progress */
334334 eaten = 1;
335335 }
336336
diff -r a7c6cd0d7ba0 -r a4652d7ec99f src/libvterm/src/pen.c
--- a/src/libvterm/src/pen.c Fri May 22 20:15:04 2020 +0200
+++ b/src/libvterm/src/pen.c Fri May 22 22:15:04 2020 +0200
@@ -11,7 +11,7 @@
1111 } VTermRGB;
1212
1313 static const VTermRGB ansi_colors[] = {
14- // R G B
14+ /* R G B */
1515 { 0, 0, 0 }, // black
1616 { 224, 0, 0 }, // red
1717 { 0, 224, 0 }, // green
@@ -465,12 +465,12 @@
465465 break;
466466 }
467467
468- if (!done)
468+ if(!done)
469469 {
470470 DEBUG_LOG1("libvterm: Unhandled CSI SGR %ld\n", arg);
471471 }
472472
473- while (CSI_ARG_HAS_MORE(args[argi++]))
473+ while(CSI_ARG_HAS_MORE(args[argi++]))
474474 ;
475475 }
476476 }
diff -r a7c6cd0d7ba0 -r a4652d7ec99f src/libvterm/src/rect.h
--- a/src/libvterm/src/rect.h Fri May 22 20:15:04 2020 +0200
+++ b/src/libvterm/src/rect.h Fri May 22 22:15:04 2020 +0200
@@ -5,7 +5,7 @@
55 #define STRFrect "(%d,%d-%d,%d)"
66 #define ARGSrect(r) (r).start_row, (r).start_col, (r).end_row, (r).end_col
77
8-// Expand dst to contain src as well
8+/* Expand dst to contain src as well */
99 static void rect_expand(VTermRect *dst, VTermRect *src)
1010 {
1111 if(dst->start_row > src->start_row) dst->start_row = src->start_row;
@@ -14,19 +14,19 @@
1414 if(dst->end_col < src->end_col) dst->end_col = src->end_col;
1515 }
1616
17-// Clip the dst to ensure it does not step outside of bounds
17+/* Clip the dst to ensure it does not step outside of bounds */
1818 static void rect_clip(VTermRect *dst, VTermRect *bounds)
1919 {
2020 if(dst->start_row < bounds->start_row) dst->start_row = bounds->start_row;
2121 if(dst->start_col < bounds->start_col) dst->start_col = bounds->start_col;
2222 if(dst->end_row > bounds->end_row) dst->end_row = bounds->end_row;
2323 if(dst->end_col > bounds->end_col) dst->end_col = bounds->end_col;
24- // Ensure it doesn't end up negatively-sized
24+ /* Ensure it doesn't end up negatively-sized */
2525 if(dst->end_row < dst->start_row) dst->end_row = dst->start_row;
2626 if(dst->end_col < dst->start_col) dst->end_col = dst->start_col;
2727 }
2828
29-// True if the two rectangles are equal
29+/* True if the two rectangles are equal */
3030 static int rect_equal(VTermRect *a, VTermRect *b)
3131 {
3232 return (a->start_row == b->start_row) &&
@@ -35,7 +35,7 @@
3535 (a->end_col == b->end_col);
3636 }
3737
38-// True if small is contained entirely within big
38+/* True if small is contained entirely within big */
3939 static int rect_contains(VTermRect *big, VTermRect *small)
4040 {
4141 if(small->start_row < big->start_row) return 0;
@@ -45,7 +45,7 @@
4545 return 1;
4646 }
4747
48-// True if the rectangles overlap at all
48+/* True if the rectangles overlap at all */
4949 static int rect_intersects(VTermRect *a, VTermRect *b)
5050 {
5151 if(a->start_row > b->end_row || b->start_row > a->end_row)
diff -r a7c6cd0d7ba0 -r a4652d7ec99f src/libvterm/src/screen.c
--- a/src/libvterm/src/screen.c Fri May 22 20:15:04 2020 +0200
+++ b/src/libvterm/src/screen.c Fri May 22 22:15:04 2020 +0200
@@ -10,10 +10,10 @@
1010 #define UNICODE_SPACE 0x20
1111 #define UNICODE_LINEFEED 0x0a
1212
13-// State of the pen at some moment in time, also used in a cell
13+/* State of the pen at some moment in time, also used in a cell */
1414 typedef struct
1515 {
16- // After the bitfield
16+ /* After the bitfield */
1717 VTermColor fg, bg;
1818
1919 unsigned int bold : 1;
@@ -23,15 +23,15 @@
2323 unsigned int reverse : 1;
2424 unsigned int conceal : 1;
2525 unsigned int strike : 1;
26- unsigned int font : 4; // 0 to 9
26+ unsigned int font : 4; /* 0 to 9 */
2727
28- // Extra state storage that isn't strictly pen-related
28+ /* Extra state storage that isn't strictly pen-related */
2929 unsigned int protected_cell : 1;
30- unsigned int dwl : 1; // on a DECDWL or DECDHL line
31- unsigned int dhl : 2; // on a DECDHL line (1=top 2=bottom)
30+ unsigned int dwl : 1; /* on a DECDWL or DECDHL line */
31+ unsigned int dhl : 2; /* on a DECDHL line (1=top 2=bottom) */
3232 } ScreenPen;
3333
34-// Internal representation of a screen cell
34+/* Internal representation of a screen cell */
3535 typedef struct
3636 {
3737 uint32_t chars[VTERM_MAX_CHARS_PER_CELL];
@@ -47,7 +47,7 @@
4747 void *cbdata;
4848
4949 VTermDamageSize damage_merge;
50- // start_row == -1 => no damage
50+ /* start_row == -1 => no damage */
5151 VTermRect damaged;
5252 VTermRect pending_scrollrect;
5353 int pending_scroll_downward, pending_scroll_rightward;
@@ -56,13 +56,13 @@
5656 int cols;
5757 int global_reverse;
5858
59- // Primary and Altscreen. buffers[1] is lazily allocated as needed
59+ /* Primary and Altscreen. buffers[1] is lazily allocated as needed */
6060 ScreenCell *buffers[2];
6161
62- // buffer will == buffers[0] or buffers[1], depending on altscreen
62+ /* buffer will == buffers[0] or buffers[1], depending on altscreen */
6363 ScreenCell *buffer;
6464
65- // buffer for a single screen row used in scrollback storage callbacks
65+ /* buffer for a single screen row used in scrollback storage callbacks */
6666 VTermScreenCell *sb_buffer;
6767
6868 ScreenPen pen;
@@ -106,13 +106,13 @@
106106
107107 switch(screen->damage_merge) {
108108 case VTERM_DAMAGE_CELL:
109- // Always emit damage event
109+ /* Always emit damage event */
110110 emit = rect;
111111 break;
112112
113113 case VTERM_DAMAGE_ROW:
114- // Emit damage longer than one row. Try to merge with existing damage in
115- // the same row
114+ /* Emit damage longer than one row. Try to merge with existing damage in
115+ * the same row */
116116 if(rect.end_row > rect.start_row + 1) {
117117 // Bigger than 1 line - flush existing, emit this
118118 vterm_screen_flush_damage(screen);
@@ -140,7 +140,7 @@
140140
141141 case VTERM_DAMAGE_SCREEN:
142142 case VTERM_DAMAGE_SCROLL:
143- // Never emit damage event
143+ /* Never emit damage event */
144144 if(screen->damaged.start_row == -1)
145145 screen->damaged = rect;
146146 else {
@@ -355,14 +355,15 @@
355355 return 1;
356356
357357 if(rect_contains(&rect, &screen->damaged)) {
358- // Scroll region entirely contains the damage; just move it
358+ /* Scroll region entirely contains the damage; just move it */
359359 vterm_rect_move(&screen->damaged, -downward, -rightward);
360360 rect_clip(&screen->damaged, &rect);
361361 }
362- // There are a number of possible cases here, but lets restrict this to only
363- // the common case where we might actually gain some performance by
364- // optimising it. Namely, a vertical scroll that neatly cuts the damage
365- // region in half.
362+ /* There are a number of possible cases here, but lets restrict this to only
363+ * the common case where we might actually gain some performance by
364+ * optimising it. Namely, a vertical scroll that neatly cuts the damage
365+ * region in half.
366+ */
366367 else if(rect.start_col <= screen->damaged.start_col &&
367368 rect.end_col >= screen->damaged.end_col &&
368369 rightward == 0) {
@@ -454,8 +455,9 @@
454455 return 0;
455456
456457 screen->buffer = val->boolean ? screen->buffers[BUFIDX_ALTSCREEN] : screen->buffers[BUFIDX_PRIMARY];
457- // only send a damage event on disable; because during enable there's an
458- // erase that sends a damage anyway
458+ /* only send a damage event on disable; because during enable there's an
459+ * erase that sends a damage anyway
460+ */
459461 if(!val->boolean)
460462 damagescreen(screen);
461463 break;
@@ -464,7 +466,7 @@
464466 damagescreen(screen);
465467 break;
466468 default:
467- ; // ignore
469+ ; /* ignore */
468470 }
469471
470472 if(screen->callbacks && screen->callbacks->settermprop)
@@ -491,7 +493,7 @@
491493 ScreenCell *old_buffer = screen->buffers[bufidx];
492494 ScreenCell *new_buffer = vterm_allocator_malloc(screen->vt, sizeof(ScreenCell) * new_rows * new_cols);
493495
494- /* Find the final row of old buffer content */
496+ // Find the final row of old buffer content
495497 int old_row = old_rows - 1;
496498 int new_row = new_rows - 1;
497499 int col;
@@ -573,10 +575,8 @@
573575 memmove(&new_buffer[0], &new_buffer[(new_row + 1) * new_cols], moverows * new_cols * sizeof(ScreenCell));
574576
575577 for(new_row = moverows; new_row < new_rows; new_row++)
576- {
577578 for(col = 0; col < new_cols; col++)
578579 clearcell(screen, &new_buffer[new_row * new_cols + col]);
579- }
580580 }
581581
582582 vterm_allocator_free(screen->vt, old_buffer);
@@ -729,6 +729,7 @@
729729 vterm_allocator_free(screen->vt, screen->buffers[BUFIDX_ALTSCREEN]);
730730
731731 vterm_allocator_free(screen->vt, screen->sb_buffer);
732+
732733 vterm_allocator_free(screen->vt, screen);
733734 }
734735
@@ -802,7 +803,7 @@
802803 return _get_chars(screen, 1, str, len, rect);
803804 }
804805
805-// Copy internal to external representation of a screen cell
806+/* Copy internal to external representation of a screen cell */
806807 int vterm_screen_get_cell(const VTermScreen *screen, VTermPos pos, VTermScreenCell *cell)
807808 {
808809 ScreenCell *intcell = getcell(screen, pos.row, pos.col);
@@ -860,7 +861,7 @@
860861
861862 int vterm_screen_is_eol(const VTermScreen *screen, VTermPos pos)
862863 {
863- // This cell is EOL if this and every cell to the right is black
864+ /* This cell is EOL if this and every cell to the right is black */
864865 for(; pos.col < screen->cols; pos.col++) {
865866 ScreenCell *cell = getcell(screen, pos.row, pos.col);
866867 if(cell->chars[0] != 0)
diff -r a7c6cd0d7ba0 -r a4652d7ec99f src/libvterm/src/state.c
--- a/src/libvterm/src/state.c Fri May 22 20:15:04 2020 +0200
+++ b/src/libvterm/src/state.c Fri May 22 22:15:04 2020 +0200
@@ -11,7 +11,7 @@
1111
1212 static int on_resize(int rows, int cols, void *user);
1313
14-// Some convenient wrappers to make callback functions easier
14+/* Some convenient wrappers to make callback functions easier */
1515
1616 static void putglyph(VTermState *state, const uint32_t chars[], int width, VTermPos pos)
1717 {
@@ -299,8 +299,9 @@
299299 codepoints, &npoints, state->gsingle_set ? 1 : (int)len,
300300 bytes, &eaten, len);
301301
302- // There's a chance an encoding (e.g. UTF-8) hasn't found enough bytes yet
303- // for even a single codepoint
302+ /* There's a chance an encoding (e.g. UTF-8) hasn't found enough bytes yet
303+ * for even a single codepoint
304+ */
304305 if(!npoints)
305306 {
306307 vterm_allocator_free(state->vt, codepoints);
@@ -310,10 +311,10 @@
310311 if(state->gsingle_set && npoints)
311312 state->gsingle_set = 0;
312313
313- // This is a combining char. that needs to be merged with the previous
314- // glyph output
314+ /* This is a combining char. that needs to be merged with the previous
315+ * glyph output */
315316 if(vterm_unicode_is_combining(codepoints[i])) {
316- // See if the cursor has moved since
317+ /* See if the cursor has moved since */
317318 if(state->pos.row == state->combine_pos.row && state->pos.col == state->combine_pos.col + state->combine_width) {
318319 #ifdef DEBUG_GLYPH_COMBINE
319320 int printpos;
@@ -323,12 +324,12 @@
323324 printf("} + {");
324325 #endif
325326
326- // Find where we need to append these combining chars
327+ /* Find where we need to append these combining chars */
327328 int saved_i = 0;
328329 while(state->combine_chars[saved_i])
329330 saved_i++;
330331
331- // Add extra ones
332+ /* Add extra ones */
332333 while(i < npoints && vterm_unicode_is_combining(codepoints[i])) {
333334 if(saved_i >= (int)state->combine_chars_size)
334335 grow_combine_buffer(state);
@@ -344,7 +345,7 @@
344345 printf("}\n");
345346 #endif
346347
347- // Now render it
348+ /* Now render it */
348349 putglyph(state, state->combine_chars, state->combine_width, state->combine_pos);
349350 }
350351 else {
@@ -418,8 +419,8 @@
418419 putglyph(state, chars, width, state->pos);
419420
420421 if(i == npoints - 1) {
421- // End of the buffer. Save the chars in case we have to combine with
422- // more on the next call
422+ /* End of the buffer. Save the chars in case we have to combine with
423+ * more on the next call */
423424 int save_i;
424425 for(save_i = 0; chars[save_i]; save_i++) {
425426 if(save_i >= (int)state->combine_chars_size)
@@ -619,8 +620,9 @@
619620 {
620621 VTermState *state = user;
621622
622- // Easier to decode this from the first byte, even though the final
623- // byte terminates it
623+ /* Easier to decode this from the first byte, even though the final
624+ * byte terminates it
625+ */
624626 switch(bytes[0]) {
625627 case ' ':
626628 if(len != 2)
@@ -1338,7 +1340,7 @@
13381340 case 2:
13391341 case 4:
13401342 break;
1341- // TODO: 1, 2 and 4 aren't meaningful yet without line tab stops
1343+ /* TODO: 1, 2 and 4 aren't meaningful yet without line tab stops */
13421344 default:
13431345 return 0;
13441346 }
@@ -1773,7 +1775,7 @@
17731775 if (newtabstops == NULL)
17741776 return 0;
17751777
1776- // TODO: This can all be done much more efficiently bytewise
1778+ /* TODO: This can all be done much more efficiently bytewise */
17771779 for(col = 0; col < state->cols && col < cols; col++) {
17781780 unsigned char mask = 1 << (col & 7);
17791781 if(state->tabstops[col >> 3] & mask)
@@ -2012,8 +2014,8 @@
20122014
20132015 int vterm_state_set_termprop(VTermState *state, VTermProp prop, VTermValue *val)
20142016 {
2015- // Only store the new value of the property if usercode said it was happy.
2016- // This is especially important for altscreen switching
2017+ /* Only store the new value of the property if usercode said it was happy.
2018+ * This is especially important for altscreen switching */
20172019 if(state->callbacks && state->callbacks->settermprop)
20182020 if(!(*state->callbacks->settermprop)(prop, val, state->cbdata))
20192021 return 0;
diff -r a7c6cd0d7ba0 -r a4652d7ec99f src/libvterm/src/unicode.c
--- a/src/libvterm/src/unicode.c Fri May 22 20:15:04 2020 +0200
+++ b/src/libvterm/src/unicode.c Fri May 22 22:15:04 2020 +0200
@@ -1,11 +1,10 @@
11 #include "vterm_internal.h"
22
3-/* ### The following from http://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c
4- * With modifications:
5- * made functions static
6- * moved 'combining' table to file scope, so other functions can see it
7- * ###################################################################
8- */
3+// ### The following from http://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c
4+// With modifications:
5+// made functions static
6+// moved 'combining' table to file scope, so other functions can see it
7+// ###################################################################
98
109 /*
1110 * This is an implementation of wcwidth() and wcswidth() (defined in
@@ -75,8 +74,8 @@
7574
7675 #if !defined(WCWIDTH_FUNCTION) || !defined(IS_COMBINING_FUNCTION)
7776
78-// sorted list of non-overlapping intervals of non-spacing characters
79-// generated by "uniset +cat=Me +cat=Mn +cat=Cf -00AD +1160-11FF +200B c"
77+/* sorted list of non-overlapping intervals of non-spacing characters */
78+/* generated by "uniset +cat=Me +cat=Mn +cat=Cf -00AD +1160-11FF +200B c" */
8079 // Replaced by the combining table from Vim.
8180 static const struct interval combining[] = {
8281 {0X0300, 0X036F},
@@ -362,7 +361,7 @@
362361 };
363362 #endif
364363
365-// auxiliary function for binary search in interval table
364+/* auxiliary function for binary search in interval table */
366365 static int bisearch(uint32_t ucs, const struct interval *table, int max) {
367366 int min = 0;
368367 int mid;
@@ -382,6 +381,7 @@
382381 return 0;
383382 }
384383
384+
385385 /* The following two functions define the column width of an ISO 10646
386386 * character as follows:
387387 *
@@ -422,30 +422,30 @@
422422
423423 static int mk_wcwidth(uint32_t ucs)
424424 {
425- // test for 8-bit control characters
425+ /* test for 8-bit control characters */
426426 if (ucs == 0)
427427 return 0;
428428 if (ucs < 32 || (ucs >= 0x7f && ucs < 0xa0))
429429 return -1;
430430
431- // binary search in table of non-spacing characters
431+ /* binary search in table of non-spacing characters */
432432 if (bisearch(ucs, combining,
433433 sizeof(combining) / sizeof(struct interval) - 1))
434434 return 0;
435435
436- // if we arrive here, ucs is not a combining or C0/C1 control character
436+ /* if we arrive here, ucs is not a combining or C0/C1 control character */
437437
438- return 1 +
438+ return 1 +
439439 (ucs >= 0x1100 &&
440- (ucs <= 0x115f || // Hangul Jamo init. consonants
440+ (ucs <= 0x115f || /* Hangul Jamo init. consonants */
441441 ucs == 0x2329 || ucs == 0x232a ||
442442 (ucs >= 0x2e80 && ucs <= 0xa4cf &&
443- ucs != 0x303f) || // CJK ... Yi
444- (ucs >= 0xac00 && ucs <= 0xd7a3) || // Hangul Syllables
445- (ucs >= 0xf900 && ucs <= 0xfaff) || // CJK Compatibility Ideographs
446- (ucs >= 0xfe10 && ucs <= 0xfe19) || // Vertical forms
447- (ucs >= 0xfe30 && ucs <= 0xfe6f) || // CJK Compatibility Forms
448- (ucs >= 0xff00 && ucs <= 0xff60) || // Fullwidth Forms
443+ ucs != 0x303f) || /* CJK ... Yi */
444+ (ucs >= 0xac00 && ucs <= 0xd7a3) || /* Hangul Syllables */
445+ (ucs >= 0xf900 && ucs <= 0xfaff) || /* CJK Compatibility Ideographs */
446+ (ucs >= 0xfe10 && ucs <= 0xfe19) || /* Vertical forms */
447+ (ucs >= 0xfe30 && ucs <= 0xfe6f) || /* CJK Compatibility Forms */
448+ (ucs >= 0xff00 && ucs <= 0xff60) || /* Fullwidth Forms */
449449 (ucs >= 0xffe0 && ucs <= 0xffe6) ||
450450 (ucs >= 0x20000 && ucs <= 0x2fffd) ||
451451 (ucs >= 0x30000 && ucs <= 0x3fffd)));
@@ -479,8 +479,8 @@
479479 static int mk_wcwidth_cjk(uint32_t ucs)
480480 {
481481 #endif
482- // sorted list of non-overlapping intervals of East Asian Ambiguous
483- // characters, generated by "uniset +WIDTH-A -cat=Me -cat=Mn -cat=Cf c"
482+ /* sorted list of non-overlapping intervals of East Asian Ambiguous
483+ * characters, generated by "uniset +WIDTH-A -cat=Me -cat=Mn -cat=Cf c" */
484484 static const struct interval ambiguous[] = {
485485 { 0x00A1, 0x00A1 }, { 0x00A4, 0x00A4 }, { 0x00A7, 0x00A8 },
486486 { 0x00AA, 0x00AA }, { 0x00AE, 0x00AE }, { 0x00B0, 0x00B4 },
@@ -537,7 +537,7 @@
537537 };
538538 #if 0
539539
540- // binary search in table of non-spacing characters
540+ /* binary search in table of non-spacing characters */
541541 if (bisearch(ucs, ambiguous,
542542 sizeof(ambiguous) / sizeof(struct interval) - 1))
543543 return 2;
@@ -545,6 +545,7 @@
545545 return mk_wcwidth(ucs);
546546 }
547547
548+
548549 static int mk_wcswidth_cjk(const uint32_t *pwcs, size_t n)
549550 {
550551 int w, width = 0;
diff -r a7c6cd0d7ba0 -r a4652d7ec99f src/libvterm/src/utf8.h
--- a/src/libvterm/src/utf8.h Fri May 22 20:15:04 2020 +0200
+++ b/src/libvterm/src/utf8.h Fri May 22 22:15:04 2020 +0200
@@ -16,7 +16,7 @@
1616 }
1717 #endif
1818
19-// Does NOT NUL-terminate the buffer
19+/* Does NOT NUL-terminate the buffer */
2020 int fill_utf8(long codepoint, char *str);
2121
2222 #if defined(DEFINE_INLINES) || USE_INLINE
@@ -44,4 +44,4 @@
4444 return nbytes;
4545 }
4646 #endif
47-// end copy
47+/* end copy */
diff -r a7c6cd0d7ba0 -r a4652d7ec99f src/libvterm/src/vterm.c
--- a/src/libvterm/src/vterm.c Fri May 22 20:15:04 2020 +0200
+++ b/src/libvterm/src/vterm.c Fri May 22 22:15:04 2020 +0200
@@ -10,9 +10,9 @@
1010
1111 #include "utf8.h"
1212
13-///////////////////
14-// API functions //
15-///////////////////
13+/*****************
14+ * API functions *
15+ *****************/
1616
1717 static void *default_malloc(size_t size, void *allocdata UNUSED)
1818 {
@@ -39,7 +39,7 @@
3939
4040 VTerm *vterm_new_with_allocator(int rows, int cols, VTermAllocatorFunctions *funcs, void *allocdata)
4141 {
42- // Need to bootstrap using the allocator function directly
42+ /* Need to bootstrap using the allocator function directly */
4343 VTerm *vt = (*funcs->malloc)(sizeof(VTerm), allocdata);
4444
4545 if (vt == NULL)
@@ -269,7 +269,7 @@
269269
270270 case VTERM_N_ATTRS: return 0;
271271 }
272- return 0; // UNREACHABLE
272+ return 0; /* UNREACHABLE */
273273 }
274274
275275 VTermValueType vterm_get_prop_type(VTermProp prop)
@@ -287,7 +287,7 @@
287287
288288 case VTERM_N_PROPS: return 0;
289289 }
290- return 0; // UNREACHABLE
290+ return 0; /* UNREACHABLE */
291291 }
292292
293293 void vterm_scroll_rect(VTermRect rect,
@@ -302,24 +302,26 @@
302302
303303 if(abs(downward) >= rect.end_row - rect.start_row ||
304304 abs(rightward) >= rect.end_col - rect.start_col) {
305- // Scroll more than area; just erase the lot
305+ /* Scroll more than area; just erase the lot */
306306 (*eraserect)(rect, 0, user);
307307 return;
308308 }
309309
310310 if(rightward >= 0) {
311- // rect: [XXX................]
312- // src: [----------------]
313- // dest: [----------------]
311+ /* rect: [XXX................]
312+ * src: [----------------]
313+ * dest: [----------------]
314+ */
314315 dest.start_col = rect.start_col;
315316 dest.end_col = rect.end_col - rightward;
316317 src.start_col = rect.start_col + rightward;
317318 src.end_col = rect.end_col;
318319 }
319320 else {
320- // rect: [................XXX]
321- // src: [----------------]
322- // dest: [----------------]
321+ /* rect: [................XXX]
322+ * src: [----------------]
323+ * dest: [----------------]
324+ */
323325 int leftward = -rightward;
324326 dest.start_col = rect.start_col + leftward;
325327 dest.end_col = rect.end_col;
@@ -375,8 +377,7 @@
375377 test_row = dest.start_row - 1;
376378 inc_row = -1;
377379 }
378- else {
379- // downward >= 0
380+ else /* downward >= 0 */ {
380381 init_row = dest.start_row;
381382 test_row = dest.end_row;
382383 inc_row = +1;
@@ -387,8 +388,7 @@
387388 test_col = dest.start_col - 1;
388389 inc_col = -1;
389390 }
390- else {
391- // rightward >= 0
391+ else /* rightward >= 0 */ {
392392 init_col = dest.start_col;
393393 test_col = dest.end_col;
394394 inc_col = +1;
diff -r a7c6cd0d7ba0 -r a4652d7ec99f src/libvterm/src/vterm_internal.h
--- a/src/libvterm/src/vterm_internal.h Fri May 22 20:15:04 2020 +0200
+++ b/src/libvterm/src/vterm_internal.h Fri May 22 22:15:04 2020 +0200
@@ -55,7 +55,7 @@
5555 unsigned int reverse:1;
5656 unsigned int conceal:1;
5757 unsigned int strike:1;
58- unsigned int font:4; // To store 0-9
58+ unsigned int font:4; /* To store 0-9 */
5959 };
6060
6161 struct VTermState
@@ -71,20 +71,20 @@
7171 int rows;
7272 int cols;
7373
74- // Current cursor position
74+ /* Current cursor position */
7575 VTermPos pos;
7676
77- int at_phantom; // True if we're on the "81st" phantom column to defer a wraparound
77+ int at_phantom; /* True if we're on the "81st" phantom column to defer a wraparound */
7878
7979 int scrollregion_top;
80- int scrollregion_bottom; // -1 means unbounded
80+ int scrollregion_bottom; /* -1 means unbounded */
8181 #define SCROLLREGION_BOTTOM(state) ((state)->scrollregion_bottom > -1 ? (state)->scrollregion_bottom : (state)->rows)
8282 int scrollregion_left;
8383 #define SCROLLREGION_LEFT(state) ((state)->mode.leftrightmargin ? (state)->scrollregion_left : 0)
84- int scrollregion_right; // -1 means unbounded
84+ int scrollregion_right; /* -1 means unbounded */
8585 #define SCROLLREGION_RIGHT(state) ((state)->mode.leftrightmargin && (state)->scrollregion_right > -1 ? (state)->scrollregion_right : (state)->cols)
8686
87- // Bitvector of tab stops
87+ /* Bitvector of tab stops */
8888 unsigned char *tabstops;
8989
9090 /* Primary and Altscreen; lineinfos[1] is lazily allocated as needed */
@@ -95,14 +95,14 @@
9595 #define ROWWIDTH(state,row) ((state)->lineinfo[(row)].doublewidth ? ((state)->cols / 2) : (state)->cols)
9696 #define THISROWWIDTH(state) ROWWIDTH(state, (state)->pos.row)
9797
98- // Mouse state
98+ /* Mouse state */
9999 int mouse_col, mouse_row;
100100 int mouse_buttons;
101101 int mouse_flags;
102102
103103 enum { MOUSE_X10, MOUSE_UTF8, MOUSE_SGR, MOUSE_RXVT } mouse_protocol;
104104
105- // Last glyph output, for Unicode recombining purposes
105+ /* Last glyph output, for Unicode recombining purposes */
106106 uint32_t *combine_chars;
107107 size_t combine_chars_size; // Number of ELEMENTS in the above
108108 int combine_width; // The width of the glyph above
@@ -139,7 +139,7 @@
139139
140140 unsigned int protected_cell : 1;
141141
142- // Saved state under DEC mode 1048/1049
142+ /* Saved state under DEC mode 1048/1049 */
143143 struct {
144144 VTermPos pos;
145145 struct VTermPen pen;
@@ -211,7 +211,7 @@
211211 int string_initial;
212212 } parser;
213213
214- // len == malloc()ed size; cur == number of valid bytes
214+ /* len == malloc()ed size; cur == number of valid bytes */
215215
216216 VTermOutputCallback *outfunc;
217217 void *outdata;
diff -r a7c6cd0d7ba0 -r a4652d7ec99f src/version.c
--- a/src/version.c Fri May 22 20:15:04 2020 +0200
+++ b/src/version.c Fri May 22 22:15:04 2020 +0200
@@ -747,6 +747,8 @@
747747 static int included_patches[] =
748748 { /* Add new patch number below this line */
749749 /**/
750+ 813,
751+/**/
750752 812,
751753 /**/
752754 811,
Show on old repository browser