Skip to content

Commit b5b49a3

Browse files
committed
patch 8.0.1639: libvterm code lags behind master
Problem: Libvterm code lags behind master. Solution: Sync to head, solve merge problems.
1 parent e7499dd commit b5b49a3

20 files changed

+390
-262
lines changed

src/libvterm/README

+18
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,21 @@ Modifications:
1010
- Add a .gitignore file.
1111
- Convert from C99 to C90.
1212
- Other changes to support embedding in Vim.
13+
14+
15+
To merge in changes from Github, do this:
16+
- Commit any pending changes.
17+
- Setup the merge tool:
18+
git config merge.tool vimdiff
19+
git config merge.conflictstyle diff3
20+
git config mergetool.prompt false
21+
- Run the merge tool:
22+
git mergetool
23+
This will open a four-way diff between:
24+
LOCAL - your current version
25+
BASE - version as it was at your last sync
26+
REMOTE - version at head on Github
27+
MERGED - best-effort merge of LOCAL and REMOTE
28+
Now find places where automatic merge didn't work, they are marked with
29+
<<<<<<<<, ======= and >>>>>>>
30+
Fix those places in MERGED, remove the markers, and save the file :wqall.

src/libvterm/bin/unterm.c

+7-6
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ static void dump_cell(const VTermScreenCell *cell, const VTermScreenCell *prevce
9595
sgr[sgri++] = 90 + (index - 8);
9696
else {
9797
sgr[sgri++] = 38;
98-
sgr[sgri++] = 5 | (1<<31);
99-
sgr[sgri++] = index | (1<<31);
98+
sgr[sgri++] = 5 | CSI_ARG_FLAG_MORE;
99+
sgr[sgri++] = index | CSI_ARG_FLAG_MORE;
100100
}
101101
}
102102

@@ -112,8 +112,8 @@ static void dump_cell(const VTermScreenCell *cell, const VTermScreenCell *prevce
112112
sgr[sgri++] = 100 + (index - 8);
113113
else {
114114
sgr[sgri++] = 48;
115-
sgr[sgri++] = 5 | (1<<31);
116-
sgr[sgri++] = index | (1<<31);
115+
sgr[sgri++] = 5 | CSI_ARG_FLAG_MORE;
116+
sgr[sgri++] = index | CSI_ARG_FLAG_MORE;
117117
}
118118
}
119119

@@ -125,9 +125,9 @@ static void dump_cell(const VTermScreenCell *cell, const VTermScreenCell *prevce
125125
int i;
126126
for(i = 0; i < sgri; i++)
127127
printf(!i ? "%d" :
128-
sgr[i] & (1<<31) ? ":%d" :
128+
CSI_ARG_HAS_MORE(sgr[i]) ? ":%d" :
129129
";%d",
130-
sgr[i] & ~(1<<31));
130+
CSI_ARG(sgr[i]));
131131
}
132132
printf("m");
133133
}
@@ -283,5 +283,6 @@ int main(int argc, char *argv[])
283283
close(fd);
284284

285285
vterm_free(vt);
286+
286287
return 0;
287288
}

src/libvterm/bin/vterm-ctrl.c

+6-2
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ static char *helptext[] = {
5353
"curblink [off|on|query]",
5454
"curshape [block|under|bar|query]",
5555
"mouse [off|click|clickdrag|motion]",
56+
"reportfocus [off|on|query]",
5657
"altscreen [off|on|query]",
5758
"bracketpaste [off|on|query]",
5859
"icontitle [STR]",
@@ -81,9 +82,9 @@ static int seticanon(int icanon, int echo)
8182
return ret;
8283
}
8384

84-
static void await_c1(int c1)
85+
static void await_c1(unsigned char c1)
8586
{
86-
int c;
87+
unsigned char c;
8788

8889
/* await CSI - 8bit or 2byte 7bit form */
8990
int in_esc = FALSE;
@@ -340,6 +341,9 @@ int main(int argc, char *argv[])
340341
printf("\x1b[?1003h"); break;
341342
}
342343
}
344+
else if(streq(arg, "reportfocus")) {
345+
do_dec_mode(1004, getboolq(&argi, argc, argv), "reportfocus");
346+
}
343347
else if(streq(arg, "altscreen")) {
344348
do_dec_mode(1049, getboolq(&argi, argc, argv), "altscreen");
345349
}

src/libvterm/bin/vterm-dump.c

+1
Original file line numberDiff line numberDiff line change
@@ -227,5 +227,6 @@ int main(int argc, char *argv[])
227227

228228
close(fd);
229229
vterm_free(vt);
230+
230231
return 0;
231232
}

src/libvterm/doc/URLs

+3
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,6 @@ Digital VT100 User Guide:
99

1010
Digital VT220 Programmer Reference Manual
1111
http://vt100.net/docs/vt220-rm/
12+
13+
Summary of ANSI standards for ASCII terminals
14+
http://www.inwap.com/pdp10/ansicode.txt

src/libvterm/doc/seqs.txt

+1
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ between states.
151151
DECSM 1000 = Mouse click/release tracking
152152
DECSM 1002 = Mouse click/release/drag tracking
153153
DECSM 1003 = Mouse all movements tracking
154+
DECSM 1004 = Focus in/out reporting
154155
DECSM 1005 = Mouse protocol extended (UTF-8) - not recommended
155156
DECSM 1006 = Mouse protocol SGR
156157
DECSM 1015 = Mouse protocol rxvt

src/libvterm/include/vterm.h

+25-9
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,9 @@ typedef enum {
9696
VTERM_VALUETYPE_BOOL = 1,
9797
VTERM_VALUETYPE_INT,
9898
VTERM_VALUETYPE_STRING,
99-
VTERM_VALUETYPE_COLOR
99+
VTERM_VALUETYPE_COLOR,
100+
101+
VTERM_N_VALUETYPES
100102
} VTermValueType;
101103

102104
typedef union {
@@ -116,7 +118,9 @@ typedef enum {
116118
VTERM_ATTR_STRIKE, /* bool: 9, 29 */
117119
VTERM_ATTR_FONT, /* number: 10-19 */
118120
VTERM_ATTR_FOREGROUND, /* color: 30-39 90-97 */
119-
VTERM_ATTR_BACKGROUND /* color: 40-49 100-107 */
121+
VTERM_ATTR_BACKGROUND, /* color: 40-49 100-107 */
122+
123+
VTERM_N_ATTRS
120124
} VTermAttr;
121125

122126
typedef enum {
@@ -129,20 +133,26 @@ typedef enum {
129133
VTERM_PROP_REVERSE, /* bool */
130134
VTERM_PROP_CURSORSHAPE, /* number */
131135
VTERM_PROP_MOUSE, /* number */
132-
VTERM_PROP_CURSORCOLOR /* string */
136+
VTERM_PROP_CURSORCOLOR, /* string */
137+
138+
VTERM_N_PROPS
133139
} VTermProp;
134140

135141
enum {
136142
VTERM_PROP_CURSORSHAPE_BLOCK = 1,
137143
VTERM_PROP_CURSORSHAPE_UNDERLINE,
138-
VTERM_PROP_CURSORSHAPE_BAR_LEFT
144+
VTERM_PROP_CURSORSHAPE_BAR_LEFT,
145+
146+
VTERM_N_PROP_CURSORSHAPES
139147
};
140148

141149
enum {
142150
VTERM_PROP_MOUSE_NONE = 0,
143151
VTERM_PROP_MOUSE_CLICK,
144152
VTERM_PROP_MOUSE_DRAG,
145-
VTERM_PROP_MOUSE_MOVE
153+
VTERM_PROP_MOUSE_MOVE,
154+
155+
VTERM_N_PROP_MOUSES
146156
};
147157

148158
typedef struct {
@@ -213,8 +223,8 @@ void vterm_mouse_button(VTerm *vt, int button, int pressed, VTermModifier mod);
213223
*
214224
* Don't confuse this with the final byte of the CSI escape; 'a' in this case.
215225
*/
216-
#define CSI_ARG_FLAG_MORE (1<<30)
217-
#define CSI_ARG_MASK (~(1<<30))
226+
#define CSI_ARG_FLAG_MORE (1U<<31)
227+
#define CSI_ARG_MASK (~(1U<<31))
218228

219229
#define CSI_ARG_HAS_MORE(a) ((a) & CSI_ARG_FLAG_MORE)
220230
#define CSI_ARG(a) ((a) & CSI_ARG_MASK)
@@ -293,6 +303,8 @@ void vterm_state_set_palette_color(VTermState *state, int index, const VTermColo
293303
void vterm_state_set_bold_highbright(VTermState *state, int bold_is_highbright);
294304
int vterm_state_get_penattr(const VTermState *state, VTermAttr attr, VTermValue *val);
295305
int vterm_state_set_termprop(VTermState *state, VTermProp prop, VTermValue *val);
306+
void vterm_state_focus_in(VTermState *state);
307+
void vterm_state_focus_out(VTermState *state);
296308
const VTermLineInfo *vterm_state_get_lineinfo(const VTermState *state, int row);
297309

298310
/* ------------
@@ -357,7 +369,9 @@ typedef enum {
357369
VTERM_DAMAGE_CELL, /* every cell */
358370
VTERM_DAMAGE_ROW, /* entire rows */
359371
VTERM_DAMAGE_SCREEN, /* entire screen */
360-
VTERM_DAMAGE_SCROLL /* entire screen + scrollrect */
372+
VTERM_DAMAGE_SCROLL, /* entire screen + scrollrect */
373+
374+
VTERM_N_DAMAGES
361375
} VTermDamageSize;
362376

363377
/* Invoke the relevant callbacks to update the screen. */
@@ -384,7 +398,9 @@ typedef enum {
384398
VTERM_ATTR_STRIKE_MASK = 1 << 5,
385399
VTERM_ATTR_FONT_MASK = 1 << 6,
386400
VTERM_ATTR_FOREGROUND_MASK = 1 << 7,
387-
VTERM_ATTR_BACKGROUND_MASK = 1 << 8
401+
VTERM_ATTR_BACKGROUND_MASK = 1 << 8,
402+
403+
VTERM_ALL_ATTRS_MASK = (1 << 9) - 1
388404
} VTermAttrMask;
389405

390406
int vterm_screen_get_attrs_extent(const VTermScreen *screen, VTermRect *extent, VTermPos pos, VTermAttrMask attrs);

src/libvterm/include/vterm_keycodes.h

+5-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ typedef enum {
55
VTERM_MOD_NONE = 0x00,
66
VTERM_MOD_SHIFT = 0x01,
77
VTERM_MOD_ALT = 0x02,
8-
VTERM_MOD_CTRL = 0x04
8+
VTERM_MOD_CTRL = 0x04,
9+
10+
VTERM_ALL_MODS_MASK = 0x07
911
} VTermModifier;
1012

1113
/* The order here must match keycodes[] in src/keyboard.c! */
@@ -53,7 +55,8 @@ typedef enum {
5355
VTERM_KEY_KP_ENTER,
5456
VTERM_KEY_KP_EQUAL,
5557

56-
VTERM_KEY_MAX /* Must be last */
58+
VTERM_KEY_MAX, /* Must be last */
59+
VTERM_N_KEYS = VTERM_KEY_MAX
5760
} VTermKey;
5861

5962
#define VTERM_KEY_FUNCTION(n) (VTERM_KEY_FUNCTION_0+(n))

src/libvterm/src/mouse.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,9 @@ void vterm_mouse_move(VTerm *vt, int row, int col, VTermModifier mod)
6363

6464
if((state->mouse_flags & MOUSE_WANT_DRAG && state->mouse_buttons) ||
6565
(state->mouse_flags & MOUSE_WANT_MOVE)) {
66-
int button = state->mouse_buttons & 0x01 ? 1 :
67-
state->mouse_buttons & 0x02 ? 2 :
68-
state->mouse_buttons & 0x04 ? 3 : 4;
66+
int button = state->mouse_buttons & MOUSE_BUTTON_LEFT ? 1 :
67+
state->mouse_buttons & MOUSE_BUTTON_MIDDLE ? 2 :
68+
state->mouse_buttons & MOUSE_BUTTON_RIGHT ? 3 : 4;
6969
output_mouse(state, button-1 + 0x20, 1, mod, col, row);
7070
}
7171
}

0 commit comments

Comments
 (0)