Skip to content

Commit b691de0

Browse files
committed
patch 8.0.1757: unnecessary changes in libvterm
Problem: Unnecessary changes in libvterm. Solution: Bring back // comments and trailing comma in enums.
1 parent 7365831 commit b691de0

File tree

16 files changed

+322
-322
lines changed

16 files changed

+322
-322
lines changed

src/libvterm/bin/unterm.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#include "vterm.h"
1010

1111
#define DEFINE_INLINES
12-
#include "../src/utf8.h" /* fill_utf8 */
12+
#include "../src/utf8.h" // fill_utf8
1313

1414
#define streq(a,b) (!strcmp(a,b))
1515

@@ -21,7 +21,7 @@ static int rows;
2121

2222
static enum {
2323
FORMAT_PLAIN,
24-
FORMAT_SGR
24+
FORMAT_SGR,
2525
} format = FORMAT_PLAIN;
2626

2727
static int col2index(VTermColor target)
@@ -44,8 +44,8 @@ static void dump_cell(const VTermScreenCell *cell, const VTermScreenCell *prevce
4444
break;
4545
case FORMAT_SGR:
4646
{
47-
/* If all 7 attributes change, that means 7 SGRs max */
48-
/* Each colour could consume up to 3 */
47+
// If all 7 attributes change, that means 7 SGRs max
48+
// Each colour could consume up to 3
4949
int sgr[7 + 2*3]; int sgri = 0;
5050

5151
if(!prevcell->attrs.bold && cell->attrs.bold)

src/libvterm/bin/vterm-ctrl.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ static int getchoice(int *argip, int argc, char *argv[], const char *options[])
3535
typedef enum {
3636
OFF,
3737
ON,
38-
QUERY
38+
QUERY,
3939
} BoolQuery;
4040

4141
static BoolQuery getboolq(int *argip, int argc, char *argv[])
@@ -105,7 +105,7 @@ static char *read_csi()
105105
unsigned char csi[32];
106106
int i = 0;
107107

108-
await_c1(0x9B); /* CSI */
108+
await_c1(0x9B); // CSI
109109

110110
/* TODO: This really should be a more robust CSI parser
111111
*/
@@ -116,7 +116,7 @@ static char *read_csi()
116116
}
117117
csi[++i] = 0;
118118

119-
/* TODO: returns longer than 32? */
119+
// TODO: returns longer than 32?
120120

121121
return strdup((char *)csi);
122122
}
@@ -131,7 +131,7 @@ static char *read_dcs()
131131

132132
for(i = 0; i < sizeof(dcs)-1; ) {
133133
char c = getchar();
134-
if(c == 0x9c) /* ST */
134+
if(c == 0x9c) // ST
135135
break;
136136
if(in_esc && c == 0x5c)
137137
break;
@@ -301,12 +301,12 @@ int main(int argc, char *argv[])
301301
do_dec_mode(12, getboolq(&argi, argc, argv), "curblink");
302302
}
303303
else if(streq(arg, "curshape")) {
304-
/* TODO: This ought to query the current value of DECSCUSR because it */
305-
/* may need blinking on or off */
304+
// TODO: This ought to query the current value of DECSCUSR because it
305+
// may need blinking on or off
306306
const char *choices[] = {"block", "under", "bar", "query", NULL};
307307
int shape = getchoice(&argi, argc, argv, choices);
308308
switch(shape) {
309-
case 3: /* query */
309+
case 3: // query
310310
shape = query_rqss_numeric(" q");
311311
switch(shape) {
312312
case 1: case 2:

src/libvterm/bin/vterm-dump.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Require getopt(3) */
1+
// Require getopt(3)
22
#define _XOPEN_SOURCE
33

44
#include <stdio.h>
@@ -22,28 +22,28 @@ static int parser_text(const char bytes[], size_t len, void *user)
2222

2323
int i;
2424
for(i = 0; i < len; /* none */) {
25-
if(b[i] < 0x20) /* C0 */
25+
if(b[i] < 0x20) // C0
2626
break;
27-
else if(b[i] < 0x80) /* ASCII */
27+
else if(b[i] < 0x80) // ASCII
2828
i++;
29-
else if(b[i] < 0xa0) /* C1 */
29+
else if(b[i] < 0xa0) // C1
3030
break;
31-
else if(b[i] < 0xc0) /* UTF-8 continuation */
31+
else if(b[i] < 0xc0) // UTF-8 continuation
3232
break;
33-
else if(b[i] < 0xe0) { /* UTF-8 2-byte */
34-
/* 2-byte UTF-8 */
33+
else if(b[i] < 0xe0) { // UTF-8 2-byte
34+
// 2-byte UTF-8
3535
if(len < i+2) break;
3636
i += 2;
3737
}
38-
else if(b[i] < 0xf0) { /* UTF-8 3-byte */
38+
else if(b[i] < 0xf0) { // UTF-8 3-byte
3939
if(len < i+3) break;
4040
i += 3;
4141
}
42-
else if(b[i] < 0xf8) { /* UTF-8 4-byte */
42+
else if(b[i] < 0xf8) { // UTF-8 4-byte
4343
if(len < i+4) break;
4444
i += 4;
4545
}
46-
else /* otherwise invalid */
46+
else // otherwise invalid
4747
break;
4848
}
4949

@@ -200,7 +200,7 @@ int main(int argc, char *argv[])
200200
file = argv[optind++];
201201

202202
if(!file || streq(file, "-"))
203-
fd = 0; /* stdin */
203+
fd = 0; // stdin
204204
else {
205205
fd = open(file, O_RDONLY);
206206
if(fd == -1) {

src/libvterm/include/vterm.h

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -110,30 +110,30 @@ typedef union {
110110

111111
typedef enum {
112112
/* VTERM_ATTR_NONE = 0 */
113-
VTERM_ATTR_BOLD = 1, /* bool: 1, 22 */
114-
VTERM_ATTR_UNDERLINE, /* number: 4, 21, 24 */
115-
VTERM_ATTR_ITALIC, /* bool: 3, 23 */
116-
VTERM_ATTR_BLINK, /* bool: 5, 25 */
117-
VTERM_ATTR_REVERSE, /* bool: 7, 27 */
118-
VTERM_ATTR_STRIKE, /* bool: 9, 29 */
119-
VTERM_ATTR_FONT, /* number: 10-19 */
120-
VTERM_ATTR_FOREGROUND, /* color: 30-39 90-97 */
121-
VTERM_ATTR_BACKGROUND, /* color: 40-49 100-107 */
113+
VTERM_ATTR_BOLD = 1, // bool: 1, 22
114+
VTERM_ATTR_UNDERLINE, // number: 4, 21, 24
115+
VTERM_ATTR_ITALIC, // bool: 3, 23
116+
VTERM_ATTR_BLINK, // bool: 5, 25
117+
VTERM_ATTR_REVERSE, // bool: 7, 27
118+
VTERM_ATTR_STRIKE, // bool: 9, 29
119+
VTERM_ATTR_FONT, // number: 10-19
120+
VTERM_ATTR_FOREGROUND, // color: 30-39 90-97
121+
VTERM_ATTR_BACKGROUND, // color: 40-49 100-107
122122

123123
VTERM_N_ATTRS
124124
} VTermAttr;
125125

126126
typedef enum {
127127
/* VTERM_PROP_NONE = 0 */
128-
VTERM_PROP_CURSORVISIBLE = 1, /* bool */
129-
VTERM_PROP_CURSORBLINK, /* bool */
130-
VTERM_PROP_ALTSCREEN, /* bool */
131-
VTERM_PROP_TITLE, /* string */
132-
VTERM_PROP_ICONNAME, /* string */
133-
VTERM_PROP_REVERSE, /* bool */
134-
VTERM_PROP_CURSORSHAPE, /* number */
135-
VTERM_PROP_MOUSE, /* number */
136-
VTERM_PROP_CURSORCOLOR, /* string */
128+
VTERM_PROP_CURSORVISIBLE = 1, // bool
129+
VTERM_PROP_CURSORBLINK, // bool
130+
VTERM_PROP_ALTSCREEN, // bool
131+
VTERM_PROP_TITLE, // string
132+
VTERM_PROP_ICONNAME, // string
133+
VTERM_PROP_REVERSE, // bool
134+
VTERM_PROP_CURSORSHAPE, // number
135+
VTERM_PROP_MOUSE, // number
136+
VTERM_PROP_CURSORCOLOR, // string
137137

138138
VTERM_N_PROPS
139139
} VTermProp;
@@ -211,9 +211,9 @@ void vterm_mouse_move(VTerm *vt, int row, int col, VTermModifier mod);
211211
* Button 4 is scroll wheel down, button 5 is scroll wheel up. */
212212
void vterm_mouse_button(VTerm *vt, int button, int pressed, VTermModifier mod);
213213

214-
/* ------------
215-
* Parser layer
216-
* ------------ */
214+
// ------------
215+
// Parser layer
216+
// ------------
217217

218218
/* Flag to indicate non-final subparameters in a single CSI parameter.
219219
* Consider
@@ -249,9 +249,9 @@ typedef struct {
249249
void vterm_parser_set_callbacks(VTerm *vt, const VTermParserCallbacks *callbacks, void *user);
250250
void *vterm_parser_get_cbdata(VTerm *vt);
251251

252-
/* -----------
253-
* State layer
254-
* ----------- */
252+
// -----------
253+
// State layer
254+
// -----------
255255

256256
typedef struct {
257257
int (*putglyph)(VTermGlyphInfo *info, VTermPos pos, void *user);
@@ -287,7 +287,7 @@ VTermState *vterm_obtain_state(VTerm *vt);
287287
void vterm_state_set_callbacks(VTermState *state, const VTermStateCallbacks *callbacks, void *user);
288288
void *vterm_state_get_cbdata(VTermState *state);
289289

290-
/* Only invokes control, csi, osc, dcs */
290+
// Only invokes control, csi, osc, dcs
291291
void vterm_state_set_unrecognised_fallbacks(VTermState *state, const VTermParserCallbacks *fallbacks, void *user);
292292
void *vterm_state_get_unrecognised_fbdata(VTermState *state);
293293

@@ -307,9 +307,9 @@ void vterm_state_focus_in(VTermState *state);
307307
void vterm_state_focus_out(VTermState *state);
308308
const VTermLineInfo *vterm_state_get_lineinfo(const VTermState *state, int row);
309309

310-
/* ------------
311-
* Screen layer
312-
* ------------ */
310+
// ------------
311+
// Screen layer
312+
// ------------
313313

314314
typedef struct {
315315
unsigned int bold : 1;
@@ -356,7 +356,7 @@ VTermScreen *vterm_obtain_screen(VTerm *vt);
356356
void vterm_screen_set_callbacks(VTermScreen *screen, const VTermScreenCallbacks *callbacks, void *user);
357357
void *vterm_screen_get_cbdata(VTermScreen *screen);
358358

359-
/* Only invokes control, csi, osc, dcs */
359+
// Only invokes control, csi, osc, dcs
360360
void vterm_screen_set_unrecognised_fallbacks(VTermScreen *screen, const VTermParserCallbacks *fallbacks, void *user);
361361
void *vterm_screen_get_unrecognised_fbdata(VTermScreen *screen);
362362

@@ -409,9 +409,9 @@ int vterm_screen_get_cell(const VTermScreen *screen, VTermPos pos, VTermScreenCe
409409

410410
int vterm_screen_is_eol(const VTermScreen *screen, VTermPos pos);
411411

412-
/* ---------
413-
* Utilities
414-
* --------- */
412+
// ---------
413+
// Utilities
414+
// ---------
415415

416416
VTermValueType vterm_get_attr_type(VTermAttr attr);
417417
VTermValueType vterm_get_prop_type(VTermProp prop);

src/libvterm/include/vterm_keycodes.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ typedef enum {
5555
VTERM_KEY_KP_ENTER,
5656
VTERM_KEY_KP_EQUAL,
5757

58-
VTERM_KEY_MAX, /* Must be last */
58+
VTERM_KEY_MAX, // Must be last
5959
VTERM_N_KEYS = VTERM_KEY_MAX
6060
} VTermKey;
6161

src/libvterm/src/encoding.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
#endif
88

99
struct UTF8DecoderData {
10-
/* number of bytes remaining in this codepoint */
10+
// number of bytes remaining in this codepoint
1111
int bytes_remaining;
1212

13-
/* number of bytes total in this codepoint once it's finished
14-
(for detecting overlongs) */
13+
// number of bytes total in this codepoint once it's finished
14+
// (for detecting overlongs)
1515
int bytes_total;
1616

1717
int this_cp;
@@ -42,7 +42,7 @@ static void decode_utf8(VTermEncoding *enc UNUSED, void *data_,
4242
printf(" pos=%zd c=%02x rem=%d\n", *pos, c, data->bytes_remaining);
4343
#endif
4444

45-
if(c < 0x20) /* C0 */
45+
if(c < 0x20) // C0
4646
return;
4747

4848
else if(c >= 0x20 && c < 0x7f) {
@@ -58,7 +58,7 @@ static void decode_utf8(VTermEncoding *enc UNUSED, void *data_,
5858
#endif
5959
}
6060

61-
else if(c == 0x7f) /* DEL */
61+
else if(c == 0x7f) // DEL
6262
return;
6363

6464
else if(c >= 0x80 && c < 0xc0) {
@@ -75,7 +75,7 @@ static void decode_utf8(VTermEncoding *enc UNUSED, void *data_,
7575
#ifdef DEBUG_PRINT_UTF8
7676
printf(" UTF-8 raw char U+%04x bytelen=%d ", data->this_cp, data->bytes_total);
7777
#endif
78-
/* Check for overlong sequences */
78+
// Check for overlong sequences
7979
switch(data->bytes_total) {
8080
case 2:
8181
if(data->this_cp < 0x0080) data->this_cp = UNICODE_INVALID;
@@ -93,7 +93,7 @@ static void decode_utf8(VTermEncoding *enc UNUSED, void *data_,
9393
if(data->this_cp < 0x4000000) data->this_cp = UNICODE_INVALID;
9494
break;
9595
}
96-
/* Now look for plain invalid ones */
96+
// Now look for plain invalid ones
9797
if((data->this_cp >= 0xD800 && data->this_cp <= 0xDFFF) ||
9898
data->this_cp == 0xFFFE ||
9999
data->this_cp == 0xFFFF)

0 commit comments

Comments
 (0)