Mercurial > vim
annotate src/libvterm/t/harness.c @ 34834:d3127b18fe1e v9.1.0286
patch 9.1.0286: Vim9: E1027 with defcompile for abstract methods
Commit: https://github.com/vim/vim/commit/1af0fbf955f799392f614bc38f9d2fcbd9960526
Author: Yegappan Lakshmanan <yegappan@yahoo.com>
Date: Tue Apr 9 21:39:27 2024 +0200
patch 9.1.0286: Vim9: E1027 with defcompile for abstract methods
Problem: Vim9: E1027 with defcompile for abstract methods with
non-void return types, but still compiles it
(zzzyxwvut)
Solution: Don't compile abstract methods
(Yegappan Lakshmanan)
fixes: #14443
closes: #14447
Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Tue, 09 Apr 2024 21:45:04 +0200 |
parents | b13f723a7ec6 |
children |
rev | line source |
---|---|
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1 #include "vterm.h" |
18802
3be01cf0a632
patch 8.1.2389: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
13531
diff
changeset
|
2 #include "../src/vterm_internal.h" // We pull in some internal bits too |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3 |
30880
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
4 #include <assert.h> |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5 #include <stdio.h> |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6 #include <string.h> |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8 #define streq(a,b) (!strcmp(a,b)) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
9 #define strstartswith(a,b) (!strncmp(a,b,strlen(b))) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
10 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
11 static size_t inplace_hex2bytes(char *s) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
12 { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
13 char *inpos = s, *outpos = s; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
14 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
15 while(*inpos) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
16 unsigned int ch; |
26270
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
17 if(sscanf(inpos, "%2x", &ch) < 1) |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
18 break; |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
19 *outpos = ch; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
20 outpos += 1; inpos += 2; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
21 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
22 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
23 return outpos - s; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
24 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
25 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
26 static VTermModifier strpe_modifiers(char **strp) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
27 { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
28 VTermModifier state = 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
29 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
30 while((*strp)[0]) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
31 switch(((*strp)++)[0]) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
32 case 'S': state |= VTERM_MOD_SHIFT; break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
33 case 'C': state |= VTERM_MOD_CTRL; break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
34 case 'A': state |= VTERM_MOD_ALT; break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
35 default: return state; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
36 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
37 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
38 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
39 return state; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
40 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
41 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
42 static VTermKey strp_key(char *str) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
43 { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
44 static struct { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
45 char *name; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
46 VTermKey key; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
47 } keys[] = { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
48 { "Up", VTERM_KEY_UP }, |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
49 { "Tab", VTERM_KEY_TAB }, |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
50 { "Enter", VTERM_KEY_ENTER }, |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
51 { "KP0", VTERM_KEY_KP_0 }, |
20458
ffadba5f898c
patch 8.2.0783: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
19995
diff
changeset
|
52 { "F1", VTERM_KEY_FUNCTION(1) }, |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
53 { NULL, VTERM_KEY_NONE }, |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
54 }; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
55 int i; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
56 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
57 for(i = 0; keys[i].name; i++) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
58 if(streq(str, keys[i].name)) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
59 return keys[i].key; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
60 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
61 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
62 return VTERM_KEY_NONE; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
63 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
64 |
20500
03826c672315
patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20496
diff
changeset
|
65 static void print_color(const VTermColor *col) |
03826c672315
patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20496
diff
changeset
|
66 { |
03826c672315
patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20496
diff
changeset
|
67 if (VTERM_COLOR_IS_RGB(col)) { |
03826c672315
patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20496
diff
changeset
|
68 printf("rgb(%d,%d,%d", col->red, col->green, col->blue); |
03826c672315
patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20496
diff
changeset
|
69 } |
03826c672315
patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20496
diff
changeset
|
70 else if (VTERM_COLOR_IS_INDEXED(col)) { |
03826c672315
patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20496
diff
changeset
|
71 printf("idx(%d", col->index); |
03826c672315
patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20496
diff
changeset
|
72 } |
03826c672315
patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20496
diff
changeset
|
73 else { |
03826c672315
patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20496
diff
changeset
|
74 printf("invalid(%d", col->type); |
03826c672315
patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20496
diff
changeset
|
75 } |
03826c672315
patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20496
diff
changeset
|
76 if (VTERM_COLOR_IS_DEFAULT_FG(col)) { |
03826c672315
patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20496
diff
changeset
|
77 printf(",is_default_fg"); |
03826c672315
patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20496
diff
changeset
|
78 } |
03826c672315
patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20496
diff
changeset
|
79 if (VTERM_COLOR_IS_DEFAULT_BG(col)) { |
03826c672315
patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20496
diff
changeset
|
80 printf(",is_default_bg"); |
03826c672315
patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20496
diff
changeset
|
81 } |
03826c672315
patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20496
diff
changeset
|
82 printf(")"); |
03826c672315
patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20496
diff
changeset
|
83 } |
03826c672315
patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20496
diff
changeset
|
84 |
32728
b13f723a7ec6
patch 9.0.1684: Update libvterm to rev 839
Christian Brabandt <cb@256bit.org>
parents:
30894
diff
changeset
|
85 static VTermColor strpe_color(char **strp) |
b13f723a7ec6
patch 9.0.1684: Update libvterm to rev 839
Christian Brabandt <cb@256bit.org>
parents:
30894
diff
changeset
|
86 { |
b13f723a7ec6
patch 9.0.1684: Update libvterm to rev 839
Christian Brabandt <cb@256bit.org>
parents:
30894
diff
changeset
|
87 uint8_t r, g, b, idx; |
b13f723a7ec6
patch 9.0.1684: Update libvterm to rev 839
Christian Brabandt <cb@256bit.org>
parents:
30894
diff
changeset
|
88 int len = 0; |
b13f723a7ec6
patch 9.0.1684: Update libvterm to rev 839
Christian Brabandt <cb@256bit.org>
parents:
30894
diff
changeset
|
89 VTermColor col; |
b13f723a7ec6
patch 9.0.1684: Update libvterm to rev 839
Christian Brabandt <cb@256bit.org>
parents:
30894
diff
changeset
|
90 |
b13f723a7ec6
patch 9.0.1684: Update libvterm to rev 839
Christian Brabandt <cb@256bit.org>
parents:
30894
diff
changeset
|
91 if(sscanf(*strp, "rgb(%hhu,%hhu,%hhu)%n", &r, &g, &b, &len) == 3 && len > 0) { |
b13f723a7ec6
patch 9.0.1684: Update libvterm to rev 839
Christian Brabandt <cb@256bit.org>
parents:
30894
diff
changeset
|
92 *strp += len; |
b13f723a7ec6
patch 9.0.1684: Update libvterm to rev 839
Christian Brabandt <cb@256bit.org>
parents:
30894
diff
changeset
|
93 vterm_color_rgb(&col, r, g, b); |
b13f723a7ec6
patch 9.0.1684: Update libvterm to rev 839
Christian Brabandt <cb@256bit.org>
parents:
30894
diff
changeset
|
94 } |
b13f723a7ec6
patch 9.0.1684: Update libvterm to rev 839
Christian Brabandt <cb@256bit.org>
parents:
30894
diff
changeset
|
95 else if(sscanf(*strp, "idx(%hhu)%n", &idx, &len) == 1 && len > 0) { |
b13f723a7ec6
patch 9.0.1684: Update libvterm to rev 839
Christian Brabandt <cb@256bit.org>
parents:
30894
diff
changeset
|
96 *strp += len; |
b13f723a7ec6
patch 9.0.1684: Update libvterm to rev 839
Christian Brabandt <cb@256bit.org>
parents:
30894
diff
changeset
|
97 vterm_color_indexed(&col, idx); |
b13f723a7ec6
patch 9.0.1684: Update libvterm to rev 839
Christian Brabandt <cb@256bit.org>
parents:
30894
diff
changeset
|
98 } |
b13f723a7ec6
patch 9.0.1684: Update libvterm to rev 839
Christian Brabandt <cb@256bit.org>
parents:
30894
diff
changeset
|
99 else |
b13f723a7ec6
patch 9.0.1684: Update libvterm to rev 839
Christian Brabandt <cb@256bit.org>
parents:
30894
diff
changeset
|
100 vterm_color_rgb(&col, 127, 127, 127); |
b13f723a7ec6
patch 9.0.1684: Update libvterm to rev 839
Christian Brabandt <cb@256bit.org>
parents:
30894
diff
changeset
|
101 |
b13f723a7ec6
patch 9.0.1684: Update libvterm to rev 839
Christian Brabandt <cb@256bit.org>
parents:
30894
diff
changeset
|
102 return col; |
b13f723a7ec6
patch 9.0.1684: Update libvterm to rev 839
Christian Brabandt <cb@256bit.org>
parents:
30894
diff
changeset
|
103 } |
b13f723a7ec6
patch 9.0.1684: Update libvterm to rev 839
Christian Brabandt <cb@256bit.org>
parents:
30894
diff
changeset
|
104 |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
105 static VTerm *vt; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
106 static VTermState *state; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
107 static VTermScreen *screen; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
108 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
109 static VTermEncodingInstance encoding; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
110 |
19995
19dc9f64a906
patch 8.2.0553: error for unused argument
Bram Moolenaar <Bram@vim.org>
parents:
19989
diff
changeset
|
111 static void term_output(const char *s, size_t len, void *user UNUSED) |
19989
deadaa5c2c49
patch 8.2.0550: some changes in the libvterm upstream code
Bram Moolenaar <Bram@vim.org>
parents:
19979
diff
changeset
|
112 { |
deadaa5c2c49
patch 8.2.0550: some changes in the libvterm upstream code
Bram Moolenaar <Bram@vim.org>
parents:
19979
diff
changeset
|
113 size_t i; |
deadaa5c2c49
patch 8.2.0550: some changes in the libvterm upstream code
Bram Moolenaar <Bram@vim.org>
parents:
19979
diff
changeset
|
114 |
deadaa5c2c49
patch 8.2.0550: some changes in the libvterm upstream code
Bram Moolenaar <Bram@vim.org>
parents:
19979
diff
changeset
|
115 printf("output "); |
deadaa5c2c49
patch 8.2.0550: some changes in the libvterm upstream code
Bram Moolenaar <Bram@vim.org>
parents:
19979
diff
changeset
|
116 for(i = 0; i < len; i++) |
deadaa5c2c49
patch 8.2.0550: some changes in the libvterm upstream code
Bram Moolenaar <Bram@vim.org>
parents:
19979
diff
changeset
|
117 printf("%x%s", (unsigned char)s[i], i < len-1 ? "," : "\n"); |
deadaa5c2c49
patch 8.2.0550: some changes in the libvterm upstream code
Bram Moolenaar <Bram@vim.org>
parents:
19979
diff
changeset
|
118 } |
deadaa5c2c49
patch 8.2.0550: some changes in the libvterm upstream code
Bram Moolenaar <Bram@vim.org>
parents:
19979
diff
changeset
|
119 |
deadaa5c2c49
patch 8.2.0550: some changes in the libvterm upstream code
Bram Moolenaar <Bram@vim.org>
parents:
19979
diff
changeset
|
120 static void printhex(const char *s, size_t len) |
deadaa5c2c49
patch 8.2.0550: some changes in the libvterm upstream code
Bram Moolenaar <Bram@vim.org>
parents:
19979
diff
changeset
|
121 { |
deadaa5c2c49
patch 8.2.0550: some changes in the libvterm upstream code
Bram Moolenaar <Bram@vim.org>
parents:
19979
diff
changeset
|
122 while(len--) |
26270
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
123 printf("%02x", (uint8_t)(s++)[0]); |
19989
deadaa5c2c49
patch 8.2.0550: some changes in the libvterm upstream code
Bram Moolenaar <Bram@vim.org>
parents:
19979
diff
changeset
|
124 } |
deadaa5c2c49
patch 8.2.0550: some changes in the libvterm upstream code
Bram Moolenaar <Bram@vim.org>
parents:
19979
diff
changeset
|
125 |
19979
a80007999d01
patch 8.2.0545: unused arguments ignored in non-standard way
Bram Moolenaar <Bram@vim.org>
parents:
19971
diff
changeset
|
126 static int parser_text(const char bytes[], size_t len, void *user UNUSED) |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
127 { |
19971
a042d2a3b13d
patch 8.2.0541: Travis CI does not give compiler warnings
Bram Moolenaar <Bram@vim.org>
parents:
18802
diff
changeset
|
128 size_t i; |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
129 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
130 printf("text "); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
131 for(i = 0; i < len; i++) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
132 unsigned char b = bytes[i]; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
133 if(b < 0x20 || b == 0x7f || (b >= 0x80 && b < 0xa0)) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
134 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
135 printf(i ? ",%x" : "%x", b); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
136 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
137 printf("\n"); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
138 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
139 return i; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
140 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
141 |
19979
a80007999d01
patch 8.2.0545: unused arguments ignored in non-standard way
Bram Moolenaar <Bram@vim.org>
parents:
19971
diff
changeset
|
142 static int parser_control(unsigned char control, void *user UNUSED) |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
143 { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
144 printf("control %02x\n", control); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
145 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
146 return 1; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
147 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
148 |
19979
a80007999d01
patch 8.2.0545: unused arguments ignored in non-standard way
Bram Moolenaar <Bram@vim.org>
parents:
19971
diff
changeset
|
149 static int parser_escape(const char bytes[], size_t len, void *user UNUSED) |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
150 { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
151 if(bytes[0] >= 0x20 && bytes[0] < 0x30) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
152 if(len < 2) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
153 return -1; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
154 len = 2; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
155 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
156 else { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
157 len = 1; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
158 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
159 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
160 printf("escape "); |
19989
deadaa5c2c49
patch 8.2.0550: some changes in the libvterm upstream code
Bram Moolenaar <Bram@vim.org>
parents:
19979
diff
changeset
|
161 printhex(bytes, len); |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
162 printf("\n"); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
163 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
164 return len; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
165 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
166 |
19979
a80007999d01
patch 8.2.0545: unused arguments ignored in non-standard way
Bram Moolenaar <Bram@vim.org>
parents:
19971
diff
changeset
|
167 static int parser_csi(const char *leader, const long args[], int argcount, const char *intermed, char command, void *user UNUSED) |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
168 { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
169 int i; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
170 printf("csi %02x", command); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
171 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
172 if(leader && leader[0]) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
173 printf(" L="); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
174 for(i = 0; leader[i]; i++) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
175 printf("%02x", leader[i]); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
176 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
177 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
178 for(i = 0; i < argcount; i++) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
179 char sep = i ? ',' : ' '; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
180 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
181 if(args[i] == CSI_ARG_MISSING) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
182 printf("%c*", sep); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
183 else |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
184 printf("%c%ld%s", sep, CSI_ARG(args[i]), CSI_ARG_HAS_MORE(args[i]) ? "+" : ""); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
185 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
186 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
187 if(intermed && intermed[0]) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
188 printf(" I="); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
189 for(i = 0; intermed[i]; i++) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
190 printf("%02x", intermed[i]); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
191 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
192 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
193 printf("\n"); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
194 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
195 return 1; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
196 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
197 |
20488
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20482
diff
changeset
|
198 static int parser_osc(int command, VTermStringFragment frag, void *user UNUSED) |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
199 { |
19971
a042d2a3b13d
patch 8.2.0541: Travis CI does not give compiler warnings
Bram Moolenaar <Bram@vim.org>
parents:
18802
diff
changeset
|
200 |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
201 printf("osc "); |
20488
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20482
diff
changeset
|
202 |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20482
diff
changeset
|
203 if(frag.initial) { |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20482
diff
changeset
|
204 if(command == -1) |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20482
diff
changeset
|
205 printf("["); |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20482
diff
changeset
|
206 else |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20482
diff
changeset
|
207 printf("[%d;", command); |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20482
diff
changeset
|
208 } |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20482
diff
changeset
|
209 |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20482
diff
changeset
|
210 printhex(frag.str, frag.len); |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20482
diff
changeset
|
211 |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20482
diff
changeset
|
212 if(frag.final) |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20482
diff
changeset
|
213 printf("]"); |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20482
diff
changeset
|
214 |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
215 printf("\n"); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
216 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
217 return 1; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
218 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
219 |
20488
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20482
diff
changeset
|
220 static int parser_dcs(const char *command, size_t commandlen, VTermStringFragment frag, void *user UNUSED) |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
221 { |
20488
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20482
diff
changeset
|
222 printf("dcs "); |
19971
a042d2a3b13d
patch 8.2.0541: Travis CI does not give compiler warnings
Bram Moolenaar <Bram@vim.org>
parents:
18802
diff
changeset
|
223 |
20488
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20482
diff
changeset
|
224 if(frag.initial) { |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20482
diff
changeset
|
225 size_t i; |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20482
diff
changeset
|
226 printf("["); |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20482
diff
changeset
|
227 for(i = 0; i < commandlen; i++) |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20482
diff
changeset
|
228 printf("%02x", command[i]); |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20482
diff
changeset
|
229 } |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20482
diff
changeset
|
230 |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20482
diff
changeset
|
231 printhex(frag.str, frag.len); |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20482
diff
changeset
|
232 |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20482
diff
changeset
|
233 if(frag.final) |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20482
diff
changeset
|
234 printf("]"); |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20482
diff
changeset
|
235 |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
236 printf("\n"); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
237 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
238 return 1; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
239 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
240 |
26270
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
241 static int parser_apc(VTermStringFragment frag, void *user UNUSED) |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
242 { |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
243 printf("apc "); |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
244 |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
245 if(frag.initial) |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
246 printf("["); |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
247 |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
248 printhex(frag.str, frag.len); |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
249 |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
250 if(frag.final) |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
251 printf("]"); |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
252 |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
253 printf("\n"); |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
254 |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
255 return 1; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
256 } |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
257 |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
258 static int parser_pm(VTermStringFragment frag, void *user UNUSED) |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
259 { |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
260 printf("pm "); |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
261 |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
262 if(frag.initial) |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
263 printf("["); |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
264 |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
265 printhex(frag.str, frag.len); |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
266 |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
267 if(frag.final) |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
268 printf("]"); |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
269 |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
270 printf("\n"); |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
271 |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
272 return 1; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
273 } |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
274 |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
275 static int parser_sos(VTermStringFragment frag, void *user UNUSED) |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
276 { |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
277 printf("sos "); |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
278 |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
279 if(frag.initial) |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
280 printf("["); |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
281 |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
282 printhex(frag.str, frag.len); |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
283 |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
284 if(frag.final) |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
285 printf("]"); |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
286 |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
287 printf("\n"); |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
288 |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
289 return 1; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
290 } |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
291 |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
292 static VTermParserCallbacks parser_cbs = { |
18802
3be01cf0a632
patch 8.1.2389: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
13531
diff
changeset
|
293 parser_text, // text |
3be01cf0a632
patch 8.1.2389: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
13531
diff
changeset
|
294 parser_control, // control |
3be01cf0a632
patch 8.1.2389: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
13531
diff
changeset
|
295 parser_escape, // escape |
3be01cf0a632
patch 8.1.2389: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
13531
diff
changeset
|
296 parser_csi, // csi |
3be01cf0a632
patch 8.1.2389: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
13531
diff
changeset
|
297 parser_osc, // osc |
3be01cf0a632
patch 8.1.2389: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
13531
diff
changeset
|
298 parser_dcs, // dcs |
26270
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
299 parser_apc, // apc |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
300 parser_pm, // pm |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
301 parser_sos, // sos |
18802
3be01cf0a632
patch 8.1.2389: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
13531
diff
changeset
|
302 NULL // resize |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
303 }; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
304 |
20496
747a270eb1db
patch 8.2.0802: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20488
diff
changeset
|
305 static VTermStateFallbacks fallbacks = { |
747a270eb1db
patch 8.2.0802: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20488
diff
changeset
|
306 parser_control, // control |
747a270eb1db
patch 8.2.0802: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20488
diff
changeset
|
307 parser_csi, // csi |
747a270eb1db
patch 8.2.0802: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20488
diff
changeset
|
308 parser_osc, // osc |
26270
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
309 parser_dcs, // dcs |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
310 parser_apc, // dcs |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
311 parser_pm, // pm |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
312 parser_sos // sos |
20496
747a270eb1db
patch 8.2.0802: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20488
diff
changeset
|
313 }; |
747a270eb1db
patch 8.2.0802: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20488
diff
changeset
|
314 |
747a270eb1db
patch 8.2.0802: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20488
diff
changeset
|
315 /* These callbacks are shared by State and Screen */ |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
316 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
317 static int want_movecursor = 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
318 static VTermPos state_pos; |
19979
a80007999d01
patch 8.2.0545: unused arguments ignored in non-standard way
Bram Moolenaar <Bram@vim.org>
parents:
19971
diff
changeset
|
319 static int movecursor(VTermPos pos, VTermPos oldpos UNUSED, int visible UNUSED, void *user UNUSED) |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
320 { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
321 state_pos = pos; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
322 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
323 if(want_movecursor) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
324 printf("movecursor %d,%d\n", pos.row, pos.col); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
325 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
326 return 1; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
327 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
328 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
329 static int want_scrollrect = 0; |
19979
a80007999d01
patch 8.2.0545: unused arguments ignored in non-standard way
Bram Moolenaar <Bram@vim.org>
parents:
19971
diff
changeset
|
330 static int scrollrect(VTermRect rect, int downward, int rightward, void *user UNUSED) |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
331 { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
332 if(!want_scrollrect) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
333 return 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
334 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
335 printf("scrollrect %d..%d,%d..%d => %+d,%+d\n", |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
336 rect.start_row, rect.end_row, rect.start_col, rect.end_col, |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
337 downward, rightward); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
338 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
339 return 1; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
340 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
341 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
342 static int want_moverect = 0; |
19979
a80007999d01
patch 8.2.0545: unused arguments ignored in non-standard way
Bram Moolenaar <Bram@vim.org>
parents:
19971
diff
changeset
|
343 static int moverect(VTermRect dest, VTermRect src, void *user UNUSED) |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
344 { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
345 if(!want_moverect) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
346 return 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
347 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
348 printf("moverect %d..%d,%d..%d -> %d..%d,%d..%d\n", |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
349 src.start_row, src.end_row, src.start_col, src.end_col, |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
350 dest.start_row, dest.end_row, dest.start_col, dest.end_col); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
351 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
352 return 1; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
353 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
354 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
355 static int want_settermprop = 0; |
19979
a80007999d01
patch 8.2.0545: unused arguments ignored in non-standard way
Bram Moolenaar <Bram@vim.org>
parents:
19971
diff
changeset
|
356 static int settermprop(VTermProp prop, VTermValue *val, void *user UNUSED) |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
357 { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
358 VTermValueType type; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
359 if(!want_settermprop) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
360 return 1; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
361 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
362 type = vterm_get_prop_type(prop); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
363 switch(type) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
364 case VTERM_VALUETYPE_BOOL: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
365 printf("settermprop %d %s\n", prop, val->boolean ? "true" : "false"); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
366 return 1; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
367 case VTERM_VALUETYPE_INT: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
368 printf("settermprop %d %d\n", prop, val->number); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
369 return 1; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
370 case VTERM_VALUETYPE_STRING: |
20488
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20482
diff
changeset
|
371 printf("settermprop %d %s\"%.*s\"%s\n", prop, |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20482
diff
changeset
|
372 val->string.initial ? "[" : "", val->string.len, val->string.str, val->string.final ? "]" : ""); |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
373 return 1; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
374 case VTERM_VALUETYPE_COLOR: |
20500
03826c672315
patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20496
diff
changeset
|
375 printf("settermprop %d ", prop); |
03826c672315
patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20496
diff
changeset
|
376 print_color(&val->color); |
03826c672315
patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20496
diff
changeset
|
377 printf("\n"); |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
378 return 1; |
13531
9f857e6310b6
patch 8.0.1639: libvterm code lags behind master
Christian Brabandt <cb@256bit.org>
parents:
11780
diff
changeset
|
379 |
9f857e6310b6
patch 8.0.1639: libvterm code lags behind master
Christian Brabandt <cb@256bit.org>
parents:
11780
diff
changeset
|
380 case VTERM_N_VALUETYPES: |
9f857e6310b6
patch 8.0.1639: libvterm code lags behind master
Christian Brabandt <cb@256bit.org>
parents:
11780
diff
changeset
|
381 return 0; |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
382 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
383 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
384 return 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
385 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
386 |
18802
3be01cf0a632
patch 8.1.2389: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
13531
diff
changeset
|
387 // These callbacks are for State |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
388 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
389 static int want_state_putglyph = 0; |
19979
a80007999d01
patch 8.2.0545: unused arguments ignored in non-standard way
Bram Moolenaar <Bram@vim.org>
parents:
19971
diff
changeset
|
390 static int state_putglyph(VTermGlyphInfo *info, VTermPos pos, void *user UNUSED) |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
391 { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
392 int i; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
393 if(!want_state_putglyph) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
394 return 1; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
395 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
396 printf("putglyph "); |
20488
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20482
diff
changeset
|
397 for(i = 0; i < VTERM_MAX_CHARS_PER_CELL && info->chars[i]; i++) |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
398 printf(i ? ",%x" : "%x", info->chars[i]); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
399 printf(" %d %d,%d", info->width, pos.row, pos.col); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
400 if(info->protected_cell) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
401 printf(" prot"); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
402 if(info->dwl) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
403 printf(" dwl"); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
404 if(info->dhl) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
405 printf(" dhl-%s", info->dhl == 1 ? "top" : info->dhl == 2 ? "bottom" : "?" ); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
406 printf("\n"); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
407 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
408 return 1; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
409 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
410 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
411 static int want_state_erase = 0; |
19979
a80007999d01
patch 8.2.0545: unused arguments ignored in non-standard way
Bram Moolenaar <Bram@vim.org>
parents:
19971
diff
changeset
|
412 static int state_erase(VTermRect rect, int selective, void *user UNUSED) |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
413 { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
414 if(!want_state_erase) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
415 return 1; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
416 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
417 printf("erase %d..%d,%d..%d%s\n", |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
418 rect.start_row, rect.end_row, rect.start_col, rect.end_col, |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
419 selective ? " selective" : ""); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
420 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
421 return 1; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
422 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
423 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
424 static struct { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
425 int bold; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
426 int underline; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
427 int italic; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
428 int blink; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
429 int reverse; |
20496
747a270eb1db
patch 8.2.0802: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20488
diff
changeset
|
430 int conceal; |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
431 int strike; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
432 int font; |
30894
bf4f25d50fdd
patch 9.0.0781: workaround to rename "small" to "smallfont" is clumsy
Bram Moolenaar <Bram@vim.org>
parents:
30884
diff
changeset
|
433 int small; |
30880
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
434 int baseline; |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
435 VTermColor foreground; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
436 VTermColor background; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
437 } state_pen; |
19979
a80007999d01
patch 8.2.0545: unused arguments ignored in non-standard way
Bram Moolenaar <Bram@vim.org>
parents:
19971
diff
changeset
|
438 static int state_setpenattr(VTermAttr attr, VTermValue *val, void *user UNUSED) |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
439 { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
440 switch(attr) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
441 case VTERM_ATTR_BOLD: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
442 state_pen.bold = val->boolean; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
443 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
444 case VTERM_ATTR_UNDERLINE: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
445 state_pen.underline = val->number; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
446 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
447 case VTERM_ATTR_ITALIC: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
448 state_pen.italic = val->boolean; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
449 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
450 case VTERM_ATTR_BLINK: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
451 state_pen.blink = val->boolean; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
452 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
453 case VTERM_ATTR_REVERSE: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
454 state_pen.reverse = val->boolean; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
455 break; |
20496
747a270eb1db
patch 8.2.0802: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20488
diff
changeset
|
456 case VTERM_ATTR_CONCEAL: |
747a270eb1db
patch 8.2.0802: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20488
diff
changeset
|
457 state_pen.conceal = val->boolean; |
747a270eb1db
patch 8.2.0802: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20488
diff
changeset
|
458 break; |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
459 case VTERM_ATTR_STRIKE: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
460 state_pen.strike = val->boolean; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
461 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
462 case VTERM_ATTR_FONT: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
463 state_pen.font = val->number; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
464 break; |
30880
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
465 case VTERM_ATTR_SMALL: |
30894
bf4f25d50fdd
patch 9.0.0781: workaround to rename "small" to "smallfont" is clumsy
Bram Moolenaar <Bram@vim.org>
parents:
30884
diff
changeset
|
466 state_pen.small = val->boolean; |
30880
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
467 break; |
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
468 case VTERM_ATTR_BASELINE: |
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
469 state_pen.baseline = val->number; |
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
470 break; |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
471 case VTERM_ATTR_FOREGROUND: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
472 state_pen.foreground = val->color; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
473 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
474 case VTERM_ATTR_BACKGROUND: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
475 state_pen.background = val->color; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
476 break; |
13531
9f857e6310b6
patch 8.0.1639: libvterm code lags behind master
Christian Brabandt <cb@256bit.org>
parents:
11780
diff
changeset
|
477 |
9f857e6310b6
patch 8.0.1639: libvterm code lags behind master
Christian Brabandt <cb@256bit.org>
parents:
11780
diff
changeset
|
478 case VTERM_N_ATTRS: |
9f857e6310b6
patch 8.0.1639: libvterm code lags behind master
Christian Brabandt <cb@256bit.org>
parents:
11780
diff
changeset
|
479 return 0; |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
480 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
481 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
482 return 1; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
483 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
484 |
19979
a80007999d01
patch 8.2.0545: unused arguments ignored in non-standard way
Bram Moolenaar <Bram@vim.org>
parents:
19971
diff
changeset
|
485 static int state_setlineinfo(int row UNUSED, const VTermLineInfo *newinfo UNUSED, const VTermLineInfo *oldinfo UNUSED, void *user UNUSED) |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
486 { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
487 return 1; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
488 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
489 |
30880
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
490 static int want_state_scrollback = 0; |
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
491 static int state_sb_clear(void *user UNUSED) { |
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
492 if(!want_state_scrollback) |
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
493 return 1; |
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
494 |
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
495 printf("sb_clear\n"); |
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
496 return 0; |
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
497 } |
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
498 |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
499 VTermStateCallbacks state_cbs = { |
18802
3be01cf0a632
patch 8.1.2389: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
13531
diff
changeset
|
500 state_putglyph, // putglyph |
3be01cf0a632
patch 8.1.2389: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
13531
diff
changeset
|
501 movecursor, // movecursor |
3be01cf0a632
patch 8.1.2389: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
13531
diff
changeset
|
502 scrollrect, // scrollrect |
3be01cf0a632
patch 8.1.2389: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
13531
diff
changeset
|
503 moverect, // moverect |
3be01cf0a632
patch 8.1.2389: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
13531
diff
changeset
|
504 state_erase, // erase |
3be01cf0a632
patch 8.1.2389: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
13531
diff
changeset
|
505 NULL, // initpen |
3be01cf0a632
patch 8.1.2389: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
13531
diff
changeset
|
506 state_setpenattr, // setpenattr |
3be01cf0a632
patch 8.1.2389: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
13531
diff
changeset
|
507 settermprop, // settermprop |
3be01cf0a632
patch 8.1.2389: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
13531
diff
changeset
|
508 NULL, // bell |
3be01cf0a632
patch 8.1.2389: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
13531
diff
changeset
|
509 NULL, // resize |
3be01cf0a632
patch 8.1.2389: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
13531
diff
changeset
|
510 state_setlineinfo, // setlineinfo |
30880
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
511 state_sb_clear, // sb_clear |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
512 }; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
513 |
26270
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
514 static int selection_set(VTermSelectionMask mask, VTermStringFragment frag, void *user UNUSED) |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
515 { |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
516 printf("selection-set mask=%04X ", mask); |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
517 if(frag.initial) |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
518 printf("["); |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
519 printhex(frag.str, frag.len); |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
520 if(frag.final) |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
521 printf("]"); |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
522 printf("\n"); |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
523 |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
524 return 1; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
525 } |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
526 |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
527 static int selection_query(VTermSelectionMask mask, void *user UNUSED) |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
528 { |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
529 printf("selection-query mask=%04X\n", mask); |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
530 |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
531 return 1; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
532 } |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
533 |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
534 VTermSelectionCallbacks selection_cbs = { |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
535 .set = selection_set, |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
536 .query = selection_query, |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
537 }; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
538 |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
539 static int want_screen_damage = 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
540 static int want_screen_damage_cells = 0; |
19979
a80007999d01
patch 8.2.0545: unused arguments ignored in non-standard way
Bram Moolenaar <Bram@vim.org>
parents:
19971
diff
changeset
|
541 static int screen_damage(VTermRect rect, void *user UNUSED) |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
542 { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
543 if(!want_screen_damage) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
544 return 1; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
545 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
546 printf("damage %d..%d,%d..%d", |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
547 rect.start_row, rect.end_row, rect.start_col, rect.end_col); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
548 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
549 if(want_screen_damage_cells) { |
11780
c76b672df584
patch 8.0.0772: other stdbool.h dependencies in libvterm
Christian Brabandt <cb@256bit.org>
parents:
11621
diff
changeset
|
550 int equals = FALSE; |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
551 int row; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
552 int col; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
553 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
554 for(row = rect.start_row; row < rect.end_row; row++) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
555 int eol = rect.end_col; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
556 while(eol > rect.start_col) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
557 VTermScreenCell cell; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
558 VTermPos pos; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
559 pos.row = row; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
560 pos.col = eol-1; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
561 vterm_screen_get_cell(screen, pos, &cell); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
562 if(cell.chars[0]) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
563 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
564 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
565 eol--; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
566 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
567 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
568 if(eol == rect.start_col) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
569 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
570 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
571 if(!equals) |
11780
c76b672df584
patch 8.0.0772: other stdbool.h dependencies in libvterm
Christian Brabandt <cb@256bit.org>
parents:
11621
diff
changeset
|
572 printf(" ="), equals = TRUE; |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
573 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
574 printf(" %d<", row); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
575 for(col = rect.start_col; col < eol; col++) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
576 VTermScreenCell cell; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
577 VTermPos pos; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
578 pos.row = row; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
579 pos.col = col; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
580 vterm_screen_get_cell(screen, pos, &cell); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
581 printf(col == rect.start_col ? "%02X" : " %02X", cell.chars[0]); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
582 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
583 printf(">"); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
584 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
585 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
586 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
587 printf("\n"); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
588 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
589 return 1; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
590 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
591 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
592 static int want_screen_scrollback = 0; |
19979
a80007999d01
patch 8.2.0545: unused arguments ignored in non-standard way
Bram Moolenaar <Bram@vim.org>
parents:
19971
diff
changeset
|
593 static int screen_sb_pushline(int cols, const VTermScreenCell *cells, void *user UNUSED) |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
594 { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
595 int eol; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
596 int c; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
597 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
598 if(!want_screen_scrollback) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
599 return 1; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
600 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
601 eol = cols; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
602 while(eol && !cells[eol-1].chars[0]) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
603 eol--; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
604 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
605 printf("sb_pushline %d =", cols); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
606 for(c = 0; c < eol; c++) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
607 printf(" %02X", cells[c].chars[0]); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
608 printf("\n"); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
609 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
610 return 1; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
611 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
612 |
19979
a80007999d01
patch 8.2.0545: unused arguments ignored in non-standard way
Bram Moolenaar <Bram@vim.org>
parents:
19971
diff
changeset
|
613 static int screen_sb_popline(int cols, VTermScreenCell *cells, void *user UNUSED) |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
614 { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
615 int col; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
616 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
617 if(!want_screen_scrollback) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
618 return 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
619 |
18802
3be01cf0a632
patch 8.1.2389: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
13531
diff
changeset
|
620 // All lines of scrollback contain "ABCDE" |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
621 for(col = 0; col < cols; col++) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
622 if(col < 5) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
623 cells[col].chars[0] = 'A' + col; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
624 else |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
625 cells[col].chars[0] = 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
626 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
627 cells[col].width = 1; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
628 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
629 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
630 printf("sb_popline %d\n", cols); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
631 return 1; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
632 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
633 |
30880
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
634 static int screen_sb_clear(void *user UNUSED) |
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
635 { |
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
636 if(!want_screen_scrollback) |
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
637 return 1; |
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
638 |
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
639 printf("sb_clear\n"); |
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
640 return 0; |
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
641 } |
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
642 |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
643 VTermScreenCallbacks screen_cbs = { |
18802
3be01cf0a632
patch 8.1.2389: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
13531
diff
changeset
|
644 screen_damage, // damage |
3be01cf0a632
patch 8.1.2389: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
13531
diff
changeset
|
645 moverect, // moverect |
3be01cf0a632
patch 8.1.2389: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
13531
diff
changeset
|
646 movecursor, // movecursor |
3be01cf0a632
patch 8.1.2389: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
13531
diff
changeset
|
647 settermprop, // settermprop |
3be01cf0a632
patch 8.1.2389: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
13531
diff
changeset
|
648 NULL, // bell |
3be01cf0a632
patch 8.1.2389: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
13531
diff
changeset
|
649 NULL, // resize |
3be01cf0a632
patch 8.1.2389: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
13531
diff
changeset
|
650 screen_sb_pushline, // sb_pushline |
30880
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
651 screen_sb_popline, // sb_popline |
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
652 screen_sb_clear, // sb_clear |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
653 }; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
654 |
19979
a80007999d01
patch 8.2.0545: unused arguments ignored in non-standard way
Bram Moolenaar <Bram@vim.org>
parents:
19971
diff
changeset
|
655 int main(int argc UNUSED, char **argv UNUSED) |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
656 { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
657 char line[1024] = {0}; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
658 int flag; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
659 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
660 int err; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
661 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
662 setvbuf(stdout, NULL, _IONBF, 0); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
663 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
664 while(fgets(line, sizeof line, stdin)) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
665 char *nl; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
666 size_t outlen; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
667 err = 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
668 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
669 if((nl = strchr(line, '\n'))) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
670 *nl = '\0'; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
671 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
672 if(streq(line, "INIT")) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
673 if(!vt) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
674 vt = vterm_new(25, 80); |
20460
c15dd3da4f47
patch 8.2.0784: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20458
diff
changeset
|
675 |
c15dd3da4f47
patch 8.2.0784: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20458
diff
changeset
|
676 // Somehow this makes tests fail |
c15dd3da4f47
patch 8.2.0784: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20458
diff
changeset
|
677 // vterm_output_set_callback(vt, term_output, NULL); |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
678 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
679 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
680 else if(streq(line, "WANTPARSER")) { |
30880
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
681 assert(vt); |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
682 vterm_parser_set_callbacks(vt, &parser_cbs, NULL); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
683 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
684 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
685 else if(strstartswith(line, "WANTSTATE") && (line[9] == '\0' || line[9] == ' ')) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
686 int i = 9; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
687 int sense = 1; |
30880
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
688 assert(vt); |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
689 if(!state) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
690 state = vterm_obtain_state(vt); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
691 vterm_state_set_callbacks(state, &state_cbs, NULL); |
32728
b13f723a7ec6
patch 9.0.1684: Update libvterm to rev 839
Christian Brabandt <cb@256bit.org>
parents:
30894
diff
changeset
|
692 /* In some tests we want to check the behaviour of overflowing the |
b13f723a7ec6
patch 9.0.1684: Update libvterm to rev 839
Christian Brabandt <cb@256bit.org>
parents:
30894
diff
changeset
|
693 * buffer, so make it nicely small |
b13f723a7ec6
patch 9.0.1684: Update libvterm to rev 839
Christian Brabandt <cb@256bit.org>
parents:
30894
diff
changeset
|
694 */ |
b13f723a7ec6
patch 9.0.1684: Update libvterm to rev 839
Christian Brabandt <cb@256bit.org>
parents:
30894
diff
changeset
|
695 vterm_state_set_selection_callbacks(state, &selection_cbs, NULL, NULL, 16); |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
696 vterm_state_set_bold_highbright(state, 1); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
697 vterm_state_reset(state, 1); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
698 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
699 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
700 while(line[i] == ' ') |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
701 i++; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
702 for( ; line[i]; i++) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
703 switch(line[i]) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
704 case '+': |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
705 sense = 1; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
706 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
707 case '-': |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
708 sense = 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
709 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
710 case 'g': |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
711 want_state_putglyph = sense; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
712 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
713 case 's': |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
714 want_scrollrect = sense; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
715 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
716 case 'm': |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
717 want_moverect = sense; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
718 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
719 case 'e': |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
720 want_state_erase = sense; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
721 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
722 case 'p': |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
723 want_settermprop = sense; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
724 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
725 case 'f': |
20496
747a270eb1db
patch 8.2.0802: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20488
diff
changeset
|
726 vterm_state_set_unrecognised_fallbacks(state, sense ? &fallbacks : NULL, NULL); |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
727 break; |
30880
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
728 case 'b': |
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
729 want_state_scrollback = sense; |
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
730 break; |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
731 default: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
732 fprintf(stderr, "Unrecognised WANTSTATE flag '%c'\n", line[i]); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
733 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
734 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
735 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
736 else if(strstartswith(line, "WANTSCREEN") && (line[10] == '\0' || line[10] == ' ')) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
737 int i = 10; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
738 int sense = 1; |
30880
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
739 assert(vt); |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
740 if(!screen) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
741 screen = vterm_obtain_screen(vt); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
742 vterm_screen_set_callbacks(screen, &screen_cbs, NULL); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
743 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
744 while(line[i] == ' ') |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
745 i++; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
746 for( ; line[i]; i++) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
747 switch(line[i]) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
748 case '-': |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
749 sense = 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
750 break; |
20482
dc88c690f19b
patch 8.2.0795: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20460
diff
changeset
|
751 case 'a': |
dc88c690f19b
patch 8.2.0795: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20460
diff
changeset
|
752 vterm_screen_enable_altscreen(screen, 1); |
dc88c690f19b
patch 8.2.0795: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20460
diff
changeset
|
753 break; |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
754 case 'd': |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
755 want_screen_damage = sense; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
756 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
757 case 'D': |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
758 want_screen_damage = sense; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
759 want_screen_damage_cells = sense; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
760 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
761 case 'm': |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
762 want_moverect = sense; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
763 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
764 case 'c': |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
765 want_movecursor = sense; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
766 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
767 case 'p': |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
768 want_settermprop = 1; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
769 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
770 case 'b': |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
771 want_screen_scrollback = sense; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
772 break; |
30880
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
773 case 'r': |
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
774 vterm_screen_enable_reflow(screen, sense); |
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
775 break; |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
776 default: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
777 fprintf(stderr, "Unrecognised WANTSCREEN flag '%c'\n", line[i]); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
778 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
779 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
780 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
781 else if(sscanf(line, "UTF8 %d", &flag)) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
782 vterm_set_utf8(vt, flag); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
783 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
784 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
785 else if(streq(line, "RESET")) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
786 if(state) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
787 vterm_state_reset(state, 1); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
788 vterm_state_get_cursorpos(state, &state_pos); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
789 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
790 if(screen) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
791 vterm_screen_reset(screen, 1); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
792 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
793 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
794 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
795 else if(strstartswith(line, "RESIZE ")) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
796 int rows, cols; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
797 char *linep = line + 7; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
798 while(linep[0] == ' ') |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
799 linep++; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
800 sscanf(linep, "%d, %d", &rows, &cols); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
801 vterm_set_size(vt, rows, cols); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
802 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
803 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
804 else if(strstartswith(line, "PUSH ")) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
805 char *bytes = line + 5; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
806 size_t len = inplace_hex2bytes(bytes); |
30880
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
807 assert(len); |
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
808 |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
809 size_t written = vterm_input_write(vt, bytes, len); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
810 if(written < len) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
811 fprintf(stderr, "! short write\n"); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
812 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
813 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
814 else if(streq(line, "WANTENCODING")) { |
18802
3be01cf0a632
patch 8.1.2389: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
13531
diff
changeset
|
815 // This isn't really external API but it's hard to get this out any |
3be01cf0a632
patch 8.1.2389: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
13531
diff
changeset
|
816 // other way |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
817 encoding.enc = vterm_lookup_encoding(ENC_UTF8, 'u'); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
818 if(encoding.enc->init) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
819 (*encoding.enc->init)(encoding.enc, encoding.data); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
820 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
821 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
822 else if(strstartswith(line, "ENCIN ")) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
823 char *bytes = line + 6; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
824 size_t len = inplace_hex2bytes(bytes); |
30880
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
825 assert(len); |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
826 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
827 uint32_t cp[1024]; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
828 int cpi = 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
829 size_t pos = 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
830 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
831 (*encoding.enc->decode)(encoding.enc, encoding.data, |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
832 cp, &cpi, len, bytes, &pos, len); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
833 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
834 if(cpi > 0) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
835 int i; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
836 printf("encout "); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
837 for(i = 0; i < cpi; i++) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
838 printf(i ? ",%x" : "%x", cp[i]); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
839 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
840 printf("\n"); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
841 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
842 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
843 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
844 else if(strstartswith(line, "INCHAR ")) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
845 char *linep = line + 7; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
846 unsigned int c = 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
847 VTermModifier mod; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
848 while(linep[0] == ' ') |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
849 linep++; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
850 mod = strpe_modifiers(&linep); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
851 sscanf(linep, " %x", &c); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
852 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
853 vterm_keyboard_unichar(vt, c, mod); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
854 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
855 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
856 else if(strstartswith(line, "INKEY ")) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
857 VTermModifier mod; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
858 VTermKey key; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
859 char *linep = line + 6; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
860 while(linep[0] == ' ') |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
861 linep++; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
862 mod = strpe_modifiers(&linep); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
863 while(linep[0] == ' ') |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
864 linep++; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
865 key = strp_key(linep); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
866 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
867 vterm_keyboard_key(vt, key, mod); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
868 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
869 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
870 else if(strstartswith(line, "PASTE ")) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
871 char *linep = line + 6; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
872 if(streq(linep, "START")) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
873 vterm_keyboard_start_paste(vt); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
874 else if(streq(linep, "END")) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
875 vterm_keyboard_end_paste(vt); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
876 else |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
877 goto abort_line; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
878 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
879 |
13531
9f857e6310b6
patch 8.0.1639: libvterm code lags behind master
Christian Brabandt <cb@256bit.org>
parents:
11780
diff
changeset
|
880 else if(strstartswith(line, "FOCUS ")) { |
30880
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
881 assert(state); |
13531
9f857e6310b6
patch 8.0.1639: libvterm code lags behind master
Christian Brabandt <cb@256bit.org>
parents:
11780
diff
changeset
|
882 char *linep = line + 6; |
9f857e6310b6
patch 8.0.1639: libvterm code lags behind master
Christian Brabandt <cb@256bit.org>
parents:
11780
diff
changeset
|
883 if(streq(linep, "IN")) |
9f857e6310b6
patch 8.0.1639: libvterm code lags behind master
Christian Brabandt <cb@256bit.org>
parents:
11780
diff
changeset
|
884 vterm_state_focus_in(state); |
9f857e6310b6
patch 8.0.1639: libvterm code lags behind master
Christian Brabandt <cb@256bit.org>
parents:
11780
diff
changeset
|
885 else if(streq(linep, "OUT")) |
9f857e6310b6
patch 8.0.1639: libvterm code lags behind master
Christian Brabandt <cb@256bit.org>
parents:
11780
diff
changeset
|
886 vterm_state_focus_out(state); |
9f857e6310b6
patch 8.0.1639: libvterm code lags behind master
Christian Brabandt <cb@256bit.org>
parents:
11780
diff
changeset
|
887 else |
9f857e6310b6
patch 8.0.1639: libvterm code lags behind master
Christian Brabandt <cb@256bit.org>
parents:
11780
diff
changeset
|
888 goto abort_line; |
9f857e6310b6
patch 8.0.1639: libvterm code lags behind master
Christian Brabandt <cb@256bit.org>
parents:
11780
diff
changeset
|
889 } |
9f857e6310b6
patch 8.0.1639: libvterm code lags behind master
Christian Brabandt <cb@256bit.org>
parents:
11780
diff
changeset
|
890 |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
891 else if(strstartswith(line, "MOUSEMOVE ")) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
892 char *linep = line + 10; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
893 int row, col, len; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
894 VTermModifier mod; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
895 while(linep[0] == ' ') |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
896 linep++; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
897 sscanf(linep, "%d,%d%n", &row, &col, &len); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
898 linep += len; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
899 while(linep[0] == ' ') |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
900 linep++; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
901 mod = strpe_modifiers(&linep); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
902 vterm_mouse_move(vt, row, col, mod); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
903 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
904 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
905 else if(strstartswith(line, "MOUSEBTN ")) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
906 char *linep = line + 9; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
907 char press; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
908 int button, len; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
909 VTermModifier mod; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
910 while(linep[0] == ' ') |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
911 linep++; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
912 sscanf(linep, "%c %d%n", &press, &button, &len); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
913 linep += len; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
914 while(linep[0] == ' ') |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
915 linep++; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
916 mod = strpe_modifiers(&linep); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
917 vterm_mouse_button(vt, button, (press == 'd' || press == 'D'), mod); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
918 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
919 |
26270
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
920 else if(strstartswith(line, "SELECTION ")) { |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
921 char *linep = line + 10; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
922 unsigned int mask; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
923 int len; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
924 VTermStringFragment frag = { 0 }; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
925 sscanf(linep, "%x%n", &mask, &len); |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
926 linep += len; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
927 while(linep[0] == ' ') |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
928 linep++; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
929 if(linep[0] == '[') { |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
930 frag.initial = TRUE; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
931 linep++; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
932 while(linep[0] == ' ') |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
933 linep++; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
934 } |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
935 frag.len = inplace_hex2bytes(linep); |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
936 frag.str = linep; |
30880
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
937 assert(frag.len); |
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
938 |
26270
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
939 linep += frag.len * 2; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
940 while(linep[0] == ' ') |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
941 linep++; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
942 if(linep[0] == ']') { |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
943 frag.final = TRUE; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
944 } |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
945 vterm_state_send_selection(state, mask, frag); |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
946 } |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
947 |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
948 else if(strstartswith(line, "DAMAGEMERGE ")) { |
30880
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
949 assert(screen); |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
950 char *linep = line + 12; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
951 while(linep[0] == ' ') |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
952 linep++; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
953 if(streq(linep, "CELL")) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
954 vterm_screen_set_damage_merge(screen, VTERM_DAMAGE_CELL); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
955 else if(streq(linep, "ROW")) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
956 vterm_screen_set_damage_merge(screen, VTERM_DAMAGE_ROW); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
957 else if(streq(linep, "SCREEN")) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
958 vterm_screen_set_damage_merge(screen, VTERM_DAMAGE_SCREEN); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
959 else if(streq(linep, "SCROLL")) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
960 vterm_screen_set_damage_merge(screen, VTERM_DAMAGE_SCROLL); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
961 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
962 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
963 else if(strstartswith(line, "DAMAGEFLUSH")) { |
30880
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
964 assert(screen); |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
965 vterm_screen_flush_damage(screen); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
966 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
967 |
32728
b13f723a7ec6
patch 9.0.1684: Update libvterm to rev 839
Christian Brabandt <cb@256bit.org>
parents:
30894
diff
changeset
|
968 else if(strstartswith(line, "SETDEFAULTCOL ")) { |
b13f723a7ec6
patch 9.0.1684: Update libvterm to rev 839
Christian Brabandt <cb@256bit.org>
parents:
30894
diff
changeset
|
969 assert(screen); |
b13f723a7ec6
patch 9.0.1684: Update libvterm to rev 839
Christian Brabandt <cb@256bit.org>
parents:
30894
diff
changeset
|
970 char *linep = line + 14; |
b13f723a7ec6
patch 9.0.1684: Update libvterm to rev 839
Christian Brabandt <cb@256bit.org>
parents:
30894
diff
changeset
|
971 while(linep[0] == ' ') |
b13f723a7ec6
patch 9.0.1684: Update libvterm to rev 839
Christian Brabandt <cb@256bit.org>
parents:
30894
diff
changeset
|
972 linep++; |
b13f723a7ec6
patch 9.0.1684: Update libvterm to rev 839
Christian Brabandt <cb@256bit.org>
parents:
30894
diff
changeset
|
973 VTermColor fg = strpe_color(&linep); |
b13f723a7ec6
patch 9.0.1684: Update libvterm to rev 839
Christian Brabandt <cb@256bit.org>
parents:
30894
diff
changeset
|
974 if(linep[0]) { |
b13f723a7ec6
patch 9.0.1684: Update libvterm to rev 839
Christian Brabandt <cb@256bit.org>
parents:
30894
diff
changeset
|
975 while(linep[0] == ' ') |
b13f723a7ec6
patch 9.0.1684: Update libvterm to rev 839
Christian Brabandt <cb@256bit.org>
parents:
30894
diff
changeset
|
976 linep++; |
b13f723a7ec6
patch 9.0.1684: Update libvterm to rev 839
Christian Brabandt <cb@256bit.org>
parents:
30894
diff
changeset
|
977 VTermColor bg = strpe_color(&linep); |
b13f723a7ec6
patch 9.0.1684: Update libvterm to rev 839
Christian Brabandt <cb@256bit.org>
parents:
30894
diff
changeset
|
978 |
b13f723a7ec6
patch 9.0.1684: Update libvterm to rev 839
Christian Brabandt <cb@256bit.org>
parents:
30894
diff
changeset
|
979 vterm_screen_set_default_colors(screen, &fg, &bg); |
b13f723a7ec6
patch 9.0.1684: Update libvterm to rev 839
Christian Brabandt <cb@256bit.org>
parents:
30894
diff
changeset
|
980 } |
b13f723a7ec6
patch 9.0.1684: Update libvterm to rev 839
Christian Brabandt <cb@256bit.org>
parents:
30894
diff
changeset
|
981 else |
b13f723a7ec6
patch 9.0.1684: Update libvterm to rev 839
Christian Brabandt <cb@256bit.org>
parents:
30894
diff
changeset
|
982 vterm_screen_set_default_colors(screen, &fg, NULL); |
b13f723a7ec6
patch 9.0.1684: Update libvterm to rev 839
Christian Brabandt <cb@256bit.org>
parents:
30894
diff
changeset
|
983 } |
b13f723a7ec6
patch 9.0.1684: Update libvterm to rev 839
Christian Brabandt <cb@256bit.org>
parents:
30894
diff
changeset
|
984 |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
985 else if(line[0] == '?') { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
986 if(streq(line, "?cursor")) { |
30880
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
987 assert(state); |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
988 VTermPos pos; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
989 vterm_state_get_cursorpos(state, &pos); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
990 if(pos.row != state_pos.row) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
991 printf("! row mismatch: state=%d,%d event=%d,%d\n", |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
992 pos.row, pos.col, state_pos.row, state_pos.col); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
993 else if(pos.col != state_pos.col) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
994 printf("! col mismatch: state=%d,%d event=%d,%d\n", |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
995 pos.row, pos.col, state_pos.row, state_pos.col); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
996 else |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
997 printf("%d,%d\n", state_pos.row, state_pos.col); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
998 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
999 else if(strstartswith(line, "?pen ")) { |
30880
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
1000 assert(state); |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1001 VTermValue val; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1002 char *linep = line + 5; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1003 while(linep[0] == ' ') |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1004 linep++; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1005 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1006 #define BOOLSTR(v) ((v) ? "on" : "off") |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1007 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1008 if(streq(linep, "bold")) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1009 vterm_state_get_penattr(state, VTERM_ATTR_BOLD, &val); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1010 if(val.boolean != state_pen.bold) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1011 printf("! pen bold mismatch; state=%s, event=%s\n", |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1012 BOOLSTR(val.boolean), BOOLSTR(state_pen.bold)); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1013 else |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1014 printf("%s\n", BOOLSTR(state_pen.bold)); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1015 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1016 else if(streq(linep, "underline")) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1017 vterm_state_get_penattr(state, VTERM_ATTR_UNDERLINE, &val); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1018 if(val.boolean != state_pen.underline) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1019 printf("! pen underline mismatch; state=%d, event=%d\n", |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1020 val.boolean, state_pen.underline); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1021 else |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1022 printf("%d\n", state_pen.underline); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1023 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1024 else if(streq(linep, "italic")) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1025 vterm_state_get_penattr(state, VTERM_ATTR_ITALIC, &val); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1026 if(val.boolean != state_pen.italic) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1027 printf("! pen italic mismatch; state=%s, event=%s\n", |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1028 BOOLSTR(val.boolean), BOOLSTR(state_pen.italic)); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1029 else |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1030 printf("%s\n", BOOLSTR(state_pen.italic)); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1031 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1032 else if(streq(linep, "blink")) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1033 vterm_state_get_penattr(state, VTERM_ATTR_BLINK, &val); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1034 if(val.boolean != state_pen.blink) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1035 printf("! pen blink mismatch; state=%s, event=%s\n", |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1036 BOOLSTR(val.boolean), BOOLSTR(state_pen.blink)); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1037 else |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1038 printf("%s\n", BOOLSTR(state_pen.blink)); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1039 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1040 else if(streq(linep, "reverse")) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1041 vterm_state_get_penattr(state, VTERM_ATTR_REVERSE, &val); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1042 if(val.boolean != state_pen.reverse) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1043 printf("! pen reverse mismatch; state=%s, event=%s\n", |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1044 BOOLSTR(val.boolean), BOOLSTR(state_pen.reverse)); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1045 else |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1046 printf("%s\n", BOOLSTR(state_pen.reverse)); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1047 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1048 else if(streq(linep, "font")) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1049 vterm_state_get_penattr(state, VTERM_ATTR_FONT, &val); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1050 if(val.boolean != state_pen.font) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1051 printf("! pen font mismatch; state=%d, event=%d\n", |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1052 val.boolean, state_pen.font); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1053 else |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1054 printf("%d\n", state_pen.font); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1055 } |
30880
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
1056 else if(streq(linep, "small")) { |
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
1057 vterm_state_get_penattr(state, VTERM_ATTR_SMALL, &val); |
30894
bf4f25d50fdd
patch 9.0.0781: workaround to rename "small" to "smallfont" is clumsy
Bram Moolenaar <Bram@vim.org>
parents:
30884
diff
changeset
|
1058 if(val.boolean != state_pen.small) |
30880
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
1059 printf("! pen small mismatch; state=%s, event=%s\n", |
30894
bf4f25d50fdd
patch 9.0.0781: workaround to rename "small" to "smallfont" is clumsy
Bram Moolenaar <Bram@vim.org>
parents:
30884
diff
changeset
|
1060 BOOLSTR(val.boolean), BOOLSTR(state_pen.small)); |
30880
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
1061 else |
30894
bf4f25d50fdd
patch 9.0.0781: workaround to rename "small" to "smallfont" is clumsy
Bram Moolenaar <Bram@vim.org>
parents:
30884
diff
changeset
|
1062 printf("%s\n", BOOLSTR(state_pen.small)); |
30880
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
1063 } |
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
1064 else if(streq(linep, "baseline")) { |
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
1065 vterm_state_get_penattr(state, VTERM_ATTR_BASELINE, &val); |
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
1066 if(val.number != state_pen.baseline) |
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
1067 printf("! pen baseline mismatch: state=%d, event=%d\n", |
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
1068 val.number, state_pen.baseline); |
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
1069 else |
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
1070 printf("%s\n", state_pen.baseline == VTERM_BASELINE_RAISE ? "raise" |
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
1071 : state_pen.baseline == VTERM_BASELINE_LOWER ? "lower" |
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
1072 : "normal"); |
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
1073 } |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1074 else if(streq(linep, "foreground")) { |
20500
03826c672315
patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20496
diff
changeset
|
1075 print_color(&state_pen.foreground); |
03826c672315
patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20496
diff
changeset
|
1076 printf("\n"); |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1077 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1078 else if(streq(linep, "background")) { |
20500
03826c672315
patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20496
diff
changeset
|
1079 print_color(&state_pen.background); |
03826c672315
patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20496
diff
changeset
|
1080 printf("\n"); |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1081 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1082 else |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1083 printf("?\n"); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1084 } |
20482
dc88c690f19b
patch 8.2.0795: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20460
diff
changeset
|
1085 else if(strstartswith(line, "?lineinfo ")) { |
30880
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
1086 assert(state); |
20482
dc88c690f19b
patch 8.2.0795: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20460
diff
changeset
|
1087 char *linep = line + 10; |
dc88c690f19b
patch 8.2.0795: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20460
diff
changeset
|
1088 int row; |
dc88c690f19b
patch 8.2.0795: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20460
diff
changeset
|
1089 const VTermLineInfo *info; |
dc88c690f19b
patch 8.2.0795: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20460
diff
changeset
|
1090 while(linep[0] == ' ') |
dc88c690f19b
patch 8.2.0795: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20460
diff
changeset
|
1091 linep++; |
dc88c690f19b
patch 8.2.0795: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20460
diff
changeset
|
1092 if(sscanf(linep, "%d", &row) < 1) { |
dc88c690f19b
patch 8.2.0795: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20460
diff
changeset
|
1093 printf("! lineinfo unrecognised input\n"); |
dc88c690f19b
patch 8.2.0795: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20460
diff
changeset
|
1094 goto abort_line; |
dc88c690f19b
patch 8.2.0795: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20460
diff
changeset
|
1095 } |
dc88c690f19b
patch 8.2.0795: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20460
diff
changeset
|
1096 info = vterm_state_get_lineinfo(state, row); |
dc88c690f19b
patch 8.2.0795: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20460
diff
changeset
|
1097 if(info->doublewidth) |
dc88c690f19b
patch 8.2.0795: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20460
diff
changeset
|
1098 printf("dwl "); |
dc88c690f19b
patch 8.2.0795: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20460
diff
changeset
|
1099 if(info->doubleheight) |
dc88c690f19b
patch 8.2.0795: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20460
diff
changeset
|
1100 printf("dhl "); |
dc88c690f19b
patch 8.2.0795: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20460
diff
changeset
|
1101 if(info->continuation) |
dc88c690f19b
patch 8.2.0795: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20460
diff
changeset
|
1102 printf("cont "); |
dc88c690f19b
patch 8.2.0795: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20460
diff
changeset
|
1103 printf("\n"); |
dc88c690f19b
patch 8.2.0795: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20460
diff
changeset
|
1104 } |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1105 else if(strstartswith(line, "?screen_chars ")) { |
30880
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
1106 assert(screen); |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1107 char *linep = line + 13; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1108 VTermRect rect; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1109 size_t len; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1110 while(linep[0] == ' ') |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1111 linep++; |
30876
2d2758ffd959
patch 9.0.0772: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26270
diff
changeset
|
1112 if(sscanf(linep, "%d,%d,%d,%d", &rect.start_row, &rect.start_col, &rect.end_row, &rect.end_col) == 4) |
2d2758ffd959
patch 9.0.0772: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26270
diff
changeset
|
1113 ; // fine |
2d2758ffd959
patch 9.0.0772: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26270
diff
changeset
|
1114 else if(sscanf(linep, "%d", &rect.start_row) == 1) { |
2d2758ffd959
patch 9.0.0772: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26270
diff
changeset
|
1115 rect.end_row = rect.start_row + 1; |
2d2758ffd959
patch 9.0.0772: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26270
diff
changeset
|
1116 rect.start_col = 0; |
2d2758ffd959
patch 9.0.0772: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26270
diff
changeset
|
1117 vterm_get_size(vt, NULL, &rect.end_col); |
2d2758ffd959
patch 9.0.0772: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26270
diff
changeset
|
1118 } |
2d2758ffd959
patch 9.0.0772: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26270
diff
changeset
|
1119 else { |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1120 printf("! screen_chars unrecognised input\n"); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1121 goto abort_line; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1122 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1123 len = vterm_screen_get_chars(screen, NULL, 0, rect); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1124 if(len == (size_t)-1) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1125 printf("! screen_chars error\n"); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1126 else if(len == 0) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1127 printf("\n"); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1128 else { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1129 uint32_t *chars = malloc(sizeof(uint32_t) * len); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1130 size_t i; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1131 vterm_screen_get_chars(screen, chars, len, rect); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1132 for(i = 0; i < len; i++) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1133 printf("0x%02x%s", chars[i], i < len-1 ? "," : "\n"); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1134 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1135 free(chars); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1136 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1137 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1138 else if(strstartswith(line, "?screen_text ")) { |
30880
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
1139 assert(screen); |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1140 char *linep = line + 12; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1141 VTermRect rect; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1142 size_t len; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1143 while(linep[0] == ' ') |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1144 linep++; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1145 if(sscanf(linep, "%d,%d,%d,%d", &rect.start_row, &rect.start_col, &rect.end_row, &rect.end_col) < 4) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1146 printf("! screen_text unrecognised input\n"); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1147 goto abort_line; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1148 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1149 len = vterm_screen_get_text(screen, NULL, 0, rect); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1150 if(len == (size_t)-1) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1151 printf("! screen_text error\n"); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1152 else if(len == 0) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1153 printf("\n"); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1154 else { |
18802
3be01cf0a632
patch 8.1.2389: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
13531
diff
changeset
|
1155 // Put an overwrite guard at both ends of the buffer |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1156 unsigned char *buffer = malloc(len + 4); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1157 unsigned char *text = buffer + 2; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1158 text[-2] = 0x55; text[-1] = 0xAA; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1159 text[len] = 0x55; text[len+1] = 0xAA; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1160 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1161 vterm_screen_get_text(screen, (char *)text, len, rect); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1162 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1163 if(text[-2] != 0x55 || text[-1] != 0xAA) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1164 printf("! screen_get_text buffer overrun left [%02x,%02x]\n", text[-2], text[-1]); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1165 else if(text[len] != 0x55 || text[len+1] != 0xAA) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1166 printf("! screen_get_text buffer overrun right [%02x,%02x]\n", text[len], text[len+1]); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1167 else |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1168 { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1169 size_t i; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1170 for(i = 0; i < len; i++) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1171 printf("0x%02x%s", text[i], i < len-1 ? "," : "\n"); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1172 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1173 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1174 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1175 free(buffer); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1176 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1177 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1178 else if(strstartswith(line, "?screen_cell ")) { |
30880
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
1179 assert(screen); |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1180 char *linep = line + 12; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1181 int i; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1182 VTermPos pos; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1183 VTermScreenCell cell; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1184 while(linep[0] == ' ') |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1185 linep++; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1186 if(sscanf(linep, "%d,%d\n", &pos.row, &pos.col) < 2) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1187 printf("! screen_cell unrecognised input\n"); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1188 goto abort_line; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1189 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1190 if(!vterm_screen_get_cell(screen, pos, &cell)) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1191 goto abort_line; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1192 printf("{"); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1193 for(i = 0; i < VTERM_MAX_CHARS_PER_CELL && cell.chars[i]; i++) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1194 printf("%s0x%x", i ? "," : "", cell.chars[i]); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1195 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1196 printf("} width=%d attrs={", cell.width); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1197 if(cell.attrs.bold) printf("B"); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1198 if(cell.attrs.underline) printf("U%d", cell.attrs.underline); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1199 if(cell.attrs.italic) printf("I"); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1200 if(cell.attrs.blink) printf("K"); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1201 if(cell.attrs.reverse) printf("R"); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1202 if(cell.attrs.font) printf("F%d", cell.attrs.font); |
30894
bf4f25d50fdd
patch 9.0.0781: workaround to rename "small" to "smallfont" is clumsy
Bram Moolenaar <Bram@vim.org>
parents:
30884
diff
changeset
|
1203 if(cell.attrs.small) printf("S"); |
30880
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
1204 if(cell.attrs.baseline) printf( |
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
1205 cell.attrs.baseline == VTERM_BASELINE_RAISE ? "^" : |
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
1206 "_"); |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1207 printf("} "); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1208 if(cell.attrs.dwl) printf("dwl "); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1209 if(cell.attrs.dhl) printf("dhl-%s ", cell.attrs.dhl == 2 ? "bottom" : "top"); |
20500
03826c672315
patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20496
diff
changeset
|
1210 printf("fg="); |
03826c672315
patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20496
diff
changeset
|
1211 vterm_screen_convert_color_to_rgb(screen, &cell.fg); |
03826c672315
patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20496
diff
changeset
|
1212 print_color(&cell.fg); |
03826c672315
patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20496
diff
changeset
|
1213 printf(" bg="); |
03826c672315
patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20496
diff
changeset
|
1214 vterm_screen_convert_color_to_rgb(screen, &cell.bg); |
03826c672315
patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20496
diff
changeset
|
1215 print_color(&cell.bg); |
03826c672315
patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20496
diff
changeset
|
1216 printf("\n"); |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1217 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1218 else if(strstartswith(line, "?screen_eol ")) { |
30880
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
1219 assert(screen); |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1220 VTermPos pos; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1221 char *linep = line + 12; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1222 while(linep[0] == ' ') |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1223 linep++; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1224 if(sscanf(linep, "%d,%d\n", &pos.row, &pos.col) < 2) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1225 printf("! screen_eol unrecognised input\n"); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1226 goto abort_line; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1227 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1228 printf("%d\n", vterm_screen_is_eol(screen, pos)); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1229 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1230 else if(strstartswith(line, "?screen_attrs_extent ")) { |
30880
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
1231 assert(screen); |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1232 VTermPos pos; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1233 VTermRect rect; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1234 char *linep = line + 21; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1235 while(linep[0] == ' ') |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1236 linep++; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1237 if(sscanf(linep, "%d,%d\n", &pos.row, &pos.col) < 2) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1238 printf("! screen_attrs_extent unrecognised input\n"); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1239 goto abort_line; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1240 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1241 rect.start_col = 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1242 rect.end_col = -1; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1243 if(!vterm_screen_get_attrs_extent(screen, &rect, pos, ~0)) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1244 printf("! screen_attrs_extent failed\n"); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1245 goto abort_line; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1246 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1247 printf("%d,%d-%d,%d\n", rect.start_row, rect.start_col, rect.end_row, rect.end_col); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1248 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1249 else |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1250 printf("?\n"); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1251 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1252 memset(line, 0, sizeof line); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1253 continue; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1254 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1255 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1256 else |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1257 abort_line: err = 1; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1258 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1259 outlen = vterm_output_get_buffer_current(vt); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1260 if(outlen > 0) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1261 char outbuff[1024]; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1262 vterm_output_read(vt, outbuff, outlen); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1263 |
19989
deadaa5c2c49
patch 8.2.0550: some changes in the libvterm upstream code
Bram Moolenaar <Bram@vim.org>
parents:
19979
diff
changeset
|
1264 term_output(outbuff, outlen, NULL); |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1265 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1266 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1267 printf(err ? "?\n" : "DONE\n"); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1268 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1269 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1270 vterm_free(vt); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1271 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1272 return 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1273 } |