Mercurial > vim
changeset 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 | a654ff3462c5 |
children | 696d046d651b |
files | src/libvterm/t/harness.c src/version.c |
diffstat | 2 files changed, 21 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/src/libvterm/t/harness.c +++ b/src/libvterm/t/harness.c @@ -65,6 +65,21 @@ static VTermScreen *screen; static VTermEncodingInstance encoding; +static void term_output(const char *s, size_t len, void *user) +{ + size_t i; + + printf("output "); + for(i = 0; i < len; i++) + printf("%x%s", (unsigned char)s[i], i < len-1 ? "," : "\n"); +} + +static void printhex(const char *s, size_t len) +{ + while(len--) + printf("%02x", (s++)[0]); +} + static int parser_text(const char bytes[], size_t len, void *user UNUSED) { size_t i; @@ -90,8 +105,6 @@ static int parser_control(unsigned char static int parser_escape(const char bytes[], size_t len, void *user UNUSED) { - size_t i; - if(bytes[0] >= 0x20 && bytes[0] < 0x30) { if(len < 2) return -1; @@ -102,8 +115,7 @@ static int parser_escape(const char byte } printf("escape "); - for(i = 0; i < len; i++) - printf("%02x", bytes[i]); + printhex(bytes, len); printf("\n"); return len; @@ -142,11 +154,9 @@ static int parser_csi(const char *leader static int parser_osc(const char *command, size_t cmdlen, void *user UNUSED) { - size_t i; printf("osc "); - for(i = 0; i < cmdlen; i++) - printf("%02x", command[i]); + printhex(command, cmdlen); printf("\n"); return 1; @@ -154,11 +164,9 @@ static int parser_osc(const char *comman static int parser_dcs(const char *command, size_t cmdlen, void *user UNUSED) { - size_t i; printf("dcs "); - for(i = 0; i < cmdlen; i++) - printf("%02x", command[i]); + printhex(command, cmdlen); printf("\n"); return 1; @@ -928,13 +936,10 @@ int main(int argc UNUSED, char **argv UN outlen = vterm_output_get_buffer_current(vt); if(outlen > 0) { - size_t i; char outbuff[1024]; vterm_output_read(vt, outbuff, outlen); - printf("output "); - for(i = 0; i < outlen; i++) - printf("%x%s", (unsigned char)outbuff[i], i < outlen-1 ? "," : "\n"); + term_output(outbuff, outlen, NULL); } printf(err ? "?\n" : "DONE\n");