Mercurial > vim
comparison src/libvterm/t/harness.c @ 19989:deadaa5c2c49 v8.2.0550
patch 8.2.0550: some changes in the libvterm upstream code
Commit: https://github.com/vim/vim/commit/88c1ee84d64d4f2cc25a95a6ccd573f8dc16b073
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Apr 12 13:38:57 2020 +0200
patch 8.2.0550: some changes in the libvterm upstream code
Problem: Some changes in the libvterm upstream code.
Solution: Include some changes.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 12 Apr 2020 13:45:04 +0200 |
parents | a80007999d01 |
children | 19dc9f64a906 |
comparison
equal
deleted
inserted
replaced
19988:a654ff3462c5 | 19989:deadaa5c2c49 |
---|---|
63 static VTermState *state; | 63 static VTermState *state; |
64 static VTermScreen *screen; | 64 static VTermScreen *screen; |
65 | 65 |
66 static VTermEncodingInstance encoding; | 66 static VTermEncodingInstance encoding; |
67 | 67 |
68 static void term_output(const char *s, size_t len, void *user) | |
69 { | |
70 size_t i; | |
71 | |
72 printf("output "); | |
73 for(i = 0; i < len; i++) | |
74 printf("%x%s", (unsigned char)s[i], i < len-1 ? "," : "\n"); | |
75 } | |
76 | |
77 static void printhex(const char *s, size_t len) | |
78 { | |
79 while(len--) | |
80 printf("%02x", (s++)[0]); | |
81 } | |
82 | |
68 static int parser_text(const char bytes[], size_t len, void *user UNUSED) | 83 static int parser_text(const char bytes[], size_t len, void *user UNUSED) |
69 { | 84 { |
70 size_t i; | 85 size_t i; |
71 | 86 |
72 printf("text "); | 87 printf("text "); |
88 return 1; | 103 return 1; |
89 } | 104 } |
90 | 105 |
91 static int parser_escape(const char bytes[], size_t len, void *user UNUSED) | 106 static int parser_escape(const char bytes[], size_t len, void *user UNUSED) |
92 { | 107 { |
93 size_t i; | |
94 | |
95 if(bytes[0] >= 0x20 && bytes[0] < 0x30) { | 108 if(bytes[0] >= 0x20 && bytes[0] < 0x30) { |
96 if(len < 2) | 109 if(len < 2) |
97 return -1; | 110 return -1; |
98 len = 2; | 111 len = 2; |
99 } | 112 } |
100 else { | 113 else { |
101 len = 1; | 114 len = 1; |
102 } | 115 } |
103 | 116 |
104 printf("escape "); | 117 printf("escape "); |
105 for(i = 0; i < len; i++) | 118 printhex(bytes, len); |
106 printf("%02x", bytes[i]); | |
107 printf("\n"); | 119 printf("\n"); |
108 | 120 |
109 return len; | 121 return len; |
110 } | 122 } |
111 | 123 |
140 return 1; | 152 return 1; |
141 } | 153 } |
142 | 154 |
143 static int parser_osc(const char *command, size_t cmdlen, void *user UNUSED) | 155 static int parser_osc(const char *command, size_t cmdlen, void *user UNUSED) |
144 { | 156 { |
145 size_t i; | |
146 | 157 |
147 printf("osc "); | 158 printf("osc "); |
148 for(i = 0; i < cmdlen; i++) | 159 printhex(command, cmdlen); |
149 printf("%02x", command[i]); | |
150 printf("\n"); | 160 printf("\n"); |
151 | 161 |
152 return 1; | 162 return 1; |
153 } | 163 } |
154 | 164 |
155 static int parser_dcs(const char *command, size_t cmdlen, void *user UNUSED) | 165 static int parser_dcs(const char *command, size_t cmdlen, void *user UNUSED) |
156 { | 166 { |
157 size_t i; | |
158 | 167 |
159 printf("dcs "); | 168 printf("dcs "); |
160 for(i = 0; i < cmdlen; i++) | 169 printhex(command, cmdlen); |
161 printf("%02x", command[i]); | |
162 printf("\n"); | 170 printf("\n"); |
163 | 171 |
164 return 1; | 172 return 1; |
165 } | 173 } |
166 | 174 |
926 else | 934 else |
927 abort_line: err = 1; | 935 abort_line: err = 1; |
928 | 936 |
929 outlen = vterm_output_get_buffer_current(vt); | 937 outlen = vterm_output_get_buffer_current(vt); |
930 if(outlen > 0) { | 938 if(outlen > 0) { |
931 size_t i; | |
932 char outbuff[1024]; | 939 char outbuff[1024]; |
933 vterm_output_read(vt, outbuff, outlen); | 940 vterm_output_read(vt, outbuff, outlen); |
934 | 941 |
935 printf("output "); | 942 term_output(outbuff, outlen, NULL); |
936 for(i = 0; i < outlen; i++) | |
937 printf("%x%s", (unsigned char)outbuff[i], i < outlen-1 ? "," : "\n"); | |
938 } | 943 } |
939 | 944 |
940 printf(err ? "?\n" : "DONE\n"); | 945 printf(err ? "?\n" : "DONE\n"); |
941 } | 946 } |
942 | 947 |