Mercurial > vim
annotate src/libvterm/src/state.c @ 31657:4473453c09b1 v9.0.1161
patch 9.0.1161: Coverity warns for using strcpy()
Commit: https://github.com/vim/vim/commit/c8ab30a349ee45ef6c3b6af8ee5ff53d2f7bf891
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Jan 9 11:35:47 2023 +0000
patch 9.0.1161: Coverity warns for using strcpy()
Problem: Coverity warns for using strcpy().
Solution: Call a function to set the function name.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 09 Jan 2023 12:45:05 +0100 |
parents | 984ebd1f6605 |
children | b13f723a7ec6 |
rev | line source |
---|---|
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1 #include "vterm_internal.h" |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3 #include <stdio.h> |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4 #include <string.h> |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6 #define strneq(a,b,n) (strncmp(a,b,n)==0) |
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 #if defined(DEBUG) && DEBUG > 1 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
9 # define DEBUG_GLYPH_COMBINE |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
10 #endif |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
11 |
11715
d7430b56c9ed
patch 8.0.0740: cannot resize a terminal window by the command
Christian Brabandt <cb@256bit.org>
parents:
11621
diff
changeset
|
12 static int on_resize(int rows, int cols, void *user); |
d7430b56c9ed
patch 8.0.0740: cannot resize a terminal window by the command
Christian Brabandt <cb@256bit.org>
parents:
11621
diff
changeset
|
13 |
20518
a4652d7ec99f
patch 8.2.0813: libvterm code is slightly different from upstream
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
14 /* Some convenient wrappers to make callback functions easier */ |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
15 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
16 static void putglyph(VTermState *state, const uint32_t chars[], int width, VTermPos pos) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
17 { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
18 VTermGlyphInfo info; |
20875
88cec48503b8
patch 8.2.0989: crash after resizing a terminal window
Bram Moolenaar <Bram@vim.org>
parents:
20518
diff
changeset
|
19 |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
20 info.chars = chars; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
21 info.width = width; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
22 info.protected_cell = state->protected_cell; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
23 info.dwl = state->lineinfo[pos.row].doublewidth; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
24 info.dhl = state->lineinfo[pos.row].doubleheight; |
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 if(state->callbacks && state->callbacks->putglyph) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
27 if((*state->callbacks->putglyph)(&info, pos, state->cbdata)) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
28 return; |
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 DEBUG_LOG3("libvterm: Unhandled putglyph U+%04x at (%d,%d)\n", chars[0], pos.col, pos.row); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
31 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
32 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
33 static void updatecursor(VTermState *state, VTermPos *oldpos, int cancel_phantom) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
34 { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
35 if(state->pos.col == oldpos->col && state->pos.row == oldpos->row) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
36 return; |
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 if(cancel_phantom) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
39 state->at_phantom = 0; |
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 if(state->callbacks && state->callbacks->movecursor) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
42 if((*state->callbacks->movecursor)(state->pos, *oldpos, state->mode.cursor_visible, state->cbdata)) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
43 return; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
44 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
45 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
46 static void erase(VTermState *state, VTermRect rect, int selective) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
47 { |
20482
dc88c690f19b
patch 8.2.0795: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20480
diff
changeset
|
48 if(rect.end_col == state->cols) { |
dc88c690f19b
patch 8.2.0795: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20480
diff
changeset
|
49 int row; |
dc88c690f19b
patch 8.2.0795: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20480
diff
changeset
|
50 /* If we're erasing the final cells of any lines, cancel the continuation |
dc88c690f19b
patch 8.2.0795: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20480
diff
changeset
|
51 * marker on the subsequent line |
dc88c690f19b
patch 8.2.0795: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20480
diff
changeset
|
52 */ |
dc88c690f19b
patch 8.2.0795: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20480
diff
changeset
|
53 for(row = rect.start_row + 1; row < rect.end_row + 1 && row < state->rows; row++) |
dc88c690f19b
patch 8.2.0795: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20480
diff
changeset
|
54 state->lineinfo[row].continuation = 0; |
dc88c690f19b
patch 8.2.0795: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20480
diff
changeset
|
55 } |
dc88c690f19b
patch 8.2.0795: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20480
diff
changeset
|
56 |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
57 if(state->callbacks && state->callbacks->erase) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
58 if((*state->callbacks->erase)(rect, selective, state->cbdata)) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
59 return; |
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 static VTermState *vterm_state_new(VTerm *vt) |
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 VTermState *state = vterm_allocator_malloc(vt, sizeof(VTermState)); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
65 |
15249
544490b69e1d
patch 8.1.0633: crash when out of memory while opening a terminal window
Bram Moolenaar <Bram@vim.org>
parents:
14315
diff
changeset
|
66 if (state == NULL) |
544490b69e1d
patch 8.1.0633: crash when out of memory while opening a terminal window
Bram Moolenaar <Bram@vim.org>
parents:
14315
diff
changeset
|
67 return NULL; |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
68 state->vt = vt; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
69 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
70 state->rows = vt->rows; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
71 state->cols = vt->cols; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
72 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
73 state->mouse_col = 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
74 state->mouse_row = 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
75 state->mouse_buttons = 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
76 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
77 state->mouse_protocol = MOUSE_X10; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
78 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
79 state->callbacks = NULL; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
80 state->cbdata = NULL; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
81 |
26270
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
82 state->selection.callbacks = NULL; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
83 state->selection.user = NULL; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
84 state->selection.buffer = NULL; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
85 |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
86 vterm_state_newpen(state); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
87 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
88 state->bold_is_highbright = 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
89 |
20480
d0bf39eb2b07
patch 8.2.0794: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20460
diff
changeset
|
90 state->combine_chars_size = 16; |
d0bf39eb2b07
patch 8.2.0794: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20460
diff
changeset
|
91 state->combine_chars = vterm_allocator_malloc(state->vt, state->combine_chars_size * sizeof(state->combine_chars[0])); |
d0bf39eb2b07
patch 8.2.0794: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20460
diff
changeset
|
92 |
d0bf39eb2b07
patch 8.2.0794: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20460
diff
changeset
|
93 state->tabstops = vterm_allocator_malloc(state->vt, (state->cols + 7) / 8); |
d0bf39eb2b07
patch 8.2.0794: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20460
diff
changeset
|
94 |
20482
dc88c690f19b
patch 8.2.0795: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20480
diff
changeset
|
95 state->lineinfos[BUFIDX_PRIMARY] = vterm_allocator_malloc(state->vt, state->rows * sizeof(VTermLineInfo)); |
dc88c690f19b
patch 8.2.0795: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20480
diff
changeset
|
96 /* TODO: Make an 'enable' function */ |
dc88c690f19b
patch 8.2.0795: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20480
diff
changeset
|
97 state->lineinfos[BUFIDX_ALTSCREEN] = vterm_allocator_malloc(state->vt, state->rows * sizeof(VTermLineInfo)); |
20480
d0bf39eb2b07
patch 8.2.0794: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20460
diff
changeset
|
98 state->lineinfo = state->lineinfos[BUFIDX_PRIMARY]; |
d0bf39eb2b07
patch 8.2.0794: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20460
diff
changeset
|
99 |
d0bf39eb2b07
patch 8.2.0794: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20460
diff
changeset
|
100 state->encoding_utf8.enc = vterm_lookup_encoding(ENC_UTF8, 'u'); |
20482
dc88c690f19b
patch 8.2.0795: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20480
diff
changeset
|
101 if(state->encoding_utf8.enc->init) |
20480
d0bf39eb2b07
patch 8.2.0794: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20460
diff
changeset
|
102 (*state->encoding_utf8.enc->init)(state->encoding_utf8.enc, state->encoding_utf8.data); |
d0bf39eb2b07
patch 8.2.0794: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20460
diff
changeset
|
103 |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
104 return state; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
105 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
106 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
107 INTERNAL void vterm_state_free(VTermState *state) |
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 vterm_allocator_free(state->vt, state->tabstops); |
20480
d0bf39eb2b07
patch 8.2.0794: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20460
diff
changeset
|
110 vterm_allocator_free(state->vt, state->lineinfos[BUFIDX_PRIMARY]); |
d0bf39eb2b07
patch 8.2.0794: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20460
diff
changeset
|
111 if(state->lineinfos[BUFIDX_ALTSCREEN]) |
d0bf39eb2b07
patch 8.2.0794: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20460
diff
changeset
|
112 vterm_allocator_free(state->vt, state->lineinfos[BUFIDX_ALTSCREEN]); |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
113 vterm_allocator_free(state->vt, state->combine_chars); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
114 vterm_allocator_free(state->vt, state); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
115 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
116 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
117 static void scroll(VTermState *state, VTermRect rect, int downward, int rightward) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
118 { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
119 int rows; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
120 int cols; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
121 if(!downward && !rightward) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
122 return; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
123 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
124 rows = rect.end_row - rect.start_row; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
125 if(downward > rows) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
126 downward = rows; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
127 else if(downward < -rows) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
128 downward = -rows; |
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 cols = rect.end_col - rect.start_col; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
131 if(rightward > cols) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
132 rightward = cols; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
133 else if(rightward < -cols) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
134 rightward = -cols; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
135 |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
136 // Update lineinfo if full line |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
137 if(rect.start_col == 0 && rect.end_col == state->cols && rightward == 0) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
138 int height = rect.end_row - rect.start_row - abs(downward); |
20480
d0bf39eb2b07
patch 8.2.0794: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20460
diff
changeset
|
139 int row; |
21749
e86237409bd2
patch 8.2.1424: Mac build fails
Bram Moolenaar <Bram@vim.org>
parents:
21042
diff
changeset
|
140 VTermLineInfo zeroLineInfo = {0x0}; |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
141 |
20480
d0bf39eb2b07
patch 8.2.0794: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20460
diff
changeset
|
142 if(downward > 0) { |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
143 memmove(state->lineinfo + rect.start_row, |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
144 state->lineinfo + rect.start_row + downward, |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
145 height * sizeof(state->lineinfo[0])); |
20480
d0bf39eb2b07
patch 8.2.0794: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20460
diff
changeset
|
146 for(row = rect.end_row - downward; row < rect.end_row; row++) |
20482
dc88c690f19b
patch 8.2.0795: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20480
diff
changeset
|
147 state->lineinfo[row] = zeroLineInfo; |
20480
d0bf39eb2b07
patch 8.2.0794: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20460
diff
changeset
|
148 } |
d0bf39eb2b07
patch 8.2.0794: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20460
diff
changeset
|
149 else { |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
150 memmove(state->lineinfo + rect.start_row - downward, |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
151 state->lineinfo + rect.start_row, |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
152 height * sizeof(state->lineinfo[0])); |
20480
d0bf39eb2b07
patch 8.2.0794: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20460
diff
changeset
|
153 for(row = rect.start_row; row < rect.start_row - downward; row++) |
20482
dc88c690f19b
patch 8.2.0795: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20480
diff
changeset
|
154 state->lineinfo[row] = zeroLineInfo; |
20480
d0bf39eb2b07
patch 8.2.0794: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20460
diff
changeset
|
155 } |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
156 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
157 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
158 if(state->callbacks && state->callbacks->scrollrect) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
159 if((*state->callbacks->scrollrect)(rect, downward, rightward, state->cbdata)) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
160 return; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
161 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
162 if(state->callbacks) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
163 vterm_scroll_rect(rect, downward, rightward, |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
164 state->callbacks->moverect, state->callbacks->erase, state->cbdata); |
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 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
167 static void linefeed(VTermState *state) |
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 if(state->pos.row == SCROLLREGION_BOTTOM(state) - 1) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
170 VTermRect rect; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
171 rect.start_row = state->scrollregion_top; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
172 rect.end_row = SCROLLREGION_BOTTOM(state); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
173 rect.start_col = SCROLLREGION_LEFT(state); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
174 rect.end_col = SCROLLREGION_RIGHT(state); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
175 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
176 scroll(state, rect, 1, 0); |
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 else if(state->pos.row < state->rows-1) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
179 state->pos.row++; |
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 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
182 static void grow_combine_buffer(VTermState *state) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
183 { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
184 size_t new_size = state->combine_chars_size * 2; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
185 uint32_t *new_chars = vterm_allocator_malloc(state->vt, new_size * sizeof(new_chars[0])); |
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 memcpy(new_chars, state->combine_chars, state->combine_chars_size * sizeof(new_chars[0])); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
188 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
189 vterm_allocator_free(state->vt, state->combine_chars); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
190 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
191 state->combine_chars = new_chars; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
192 state->combine_chars_size = new_size; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
193 } |
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 static void set_col_tabstop(VTermState *state, int col) |
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 unsigned char mask = 1 << (col & 7); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
198 state->tabstops[col >> 3] |= mask; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
199 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
200 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
201 static void clear_col_tabstop(VTermState *state, int col) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
202 { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
203 unsigned char mask = 1 << (col & 7); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
204 state->tabstops[col >> 3] &= ~mask; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
205 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
206 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
207 static int is_col_tabstop(VTermState *state, int col) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
208 { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
209 unsigned char mask = 1 << (col & 7); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
210 return state->tabstops[col >> 3] & mask; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
211 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
212 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
213 static int is_cursor_in_scrollregion(const VTermState *state) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
214 { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
215 if(state->pos.row < state->scrollregion_top || |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
216 state->pos.row >= SCROLLREGION_BOTTOM(state)) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
217 return 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
218 if(state->pos.col < SCROLLREGION_LEFT(state) || |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
219 state->pos.col >= SCROLLREGION_RIGHT(state)) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
220 return 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
221 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
222 return 1; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
223 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
224 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
225 static void tab(VTermState *state, int count, int direction) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
226 { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
227 while(count > 0) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
228 if(direction > 0) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
229 if(state->pos.col >= THISROWWIDTH(state)-1) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
230 return; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
231 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
232 state->pos.col++; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
233 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
234 else if(direction < 0) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
235 if(state->pos.col < 1) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
236 return; |
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 state->pos.col--; |
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 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
241 if(is_col_tabstop(state, state->pos.col)) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
242 count--; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
243 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
244 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
245 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
246 #define NO_FORCE 0 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
247 #define FORCE 1 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
248 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
249 #define DWL_OFF 0 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
250 #define DWL_ON 1 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
251 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
252 #define DHL_OFF 0 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
253 #define DHL_TOP 1 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
254 #define DHL_BOTTOM 2 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
255 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
256 static void set_lineinfo(VTermState *state, int row, int force, int dwl, int dhl) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
257 { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
258 VTermLineInfo info = state->lineinfo[row]; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
259 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
260 if(dwl == DWL_OFF) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
261 info.doublewidth = DWL_OFF; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
262 else if(dwl == DWL_ON) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
263 info.doublewidth = DWL_ON; |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
264 // else -1 to ignore |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
265 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
266 if(dhl == DHL_OFF) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
267 info.doubleheight = DHL_OFF; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
268 else if(dhl == DHL_TOP) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
269 info.doubleheight = DHL_TOP; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
270 else if(dhl == DHL_BOTTOM) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
271 info.doubleheight = DHL_BOTTOM; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
272 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
273 if((state->callbacks && |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
274 state->callbacks->setlineinfo && |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
275 (*state->callbacks->setlineinfo)(row, &info, state->lineinfo + row, state->cbdata)) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
276 || force) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
277 state->lineinfo[row] = info; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
278 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
279 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
280 static int on_text(const char bytes[], size_t len, void *user) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
281 { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
282 VTermState *state = user; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
283 int npoints = 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
284 size_t eaten = 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
285 VTermEncodingInstance *encoding; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
286 int i = 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
287 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
288 VTermPos oldpos = state->pos; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
289 |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
290 // We'll have at most len codepoints, plus one from a previous incomplete |
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
291 // sequence. |
30876
2d2758ffd959
patch 9.0.0772: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26272
diff
changeset
|
292 uint32_t *codepoints = (uint32_t *)(state->vt->tmpbuffer); |
2d2758ffd959
patch 9.0.0772: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26272
diff
changeset
|
293 size_t maxpoints = (state->vt->tmpbuffer_len) / sizeof(uint32_t); |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
294 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
295 encoding = |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
296 state->gsingle_set ? &state->encoding[state->gsingle_set] : |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
297 !(bytes[eaten] & 0x80) ? &state->encoding[state->gl_set] : |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
298 state->vt->mode.utf8 ? &state->encoding_utf8 : |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
299 &state->encoding[state->gr_set]; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
300 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
301 (*encoding->enc->decode)(encoding->enc, encoding->data, |
30876
2d2758ffd959
patch 9.0.0772: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26272
diff
changeset
|
302 codepoints, &npoints, state->gsingle_set ? 1 : (int)maxpoints, |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
303 bytes, &eaten, len); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
304 |
20518
a4652d7ec99f
patch 8.2.0813: libvterm code is slightly different from upstream
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
305 /* There's a chance an encoding (e.g. UTF-8) hasn't found enough bytes yet |
a4652d7ec99f
patch 8.2.0813: libvterm code is slightly different from upstream
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
306 * for even a single codepoint |
a4652d7ec99f
patch 8.2.0813: libvterm code is slightly different from upstream
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
307 */ |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
308 if(!npoints) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
309 { |
14315
17ade2ec0616
patch 8.1.0173: compiler warning on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
13770
diff
changeset
|
310 return (int)eaten; |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
311 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
312 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
313 if(state->gsingle_set && npoints) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
314 state->gsingle_set = 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
315 |
20518
a4652d7ec99f
patch 8.2.0813: libvterm code is slightly different from upstream
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
316 /* This is a combining char. that needs to be merged with the previous |
a4652d7ec99f
patch 8.2.0813: libvterm code is slightly different from upstream
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
317 * glyph output */ |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
318 if(vterm_unicode_is_combining(codepoints[i])) { |
20518
a4652d7ec99f
patch 8.2.0813: libvterm code is slightly different from upstream
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
319 /* See if the cursor has moved since */ |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
320 if(state->pos.row == state->combine_pos.row && state->pos.col == state->combine_pos.col + state->combine_width) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
321 #ifdef DEBUG_GLYPH_COMBINE |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
322 int printpos; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
323 printf("DEBUG: COMBINING SPLIT GLYPH of chars {"); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
324 for(printpos = 0; state->combine_chars[printpos]; printpos++) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
325 printf("U+%04x ", state->combine_chars[printpos]); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
326 printf("} + {"); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
327 #endif |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
328 |
20518
a4652d7ec99f
patch 8.2.0813: libvterm code is slightly different from upstream
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
329 /* Find where we need to append these combining chars */ |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
330 int saved_i = 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
331 while(state->combine_chars[saved_i]) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
332 saved_i++; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
333 |
20518
a4652d7ec99f
patch 8.2.0813: libvterm code is slightly different from upstream
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
334 /* Add extra ones */ |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
335 while(i < npoints && vterm_unicode_is_combining(codepoints[i])) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
336 if(saved_i >= (int)state->combine_chars_size) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
337 grow_combine_buffer(state); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
338 state->combine_chars[saved_i++] = codepoints[i++]; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
339 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
340 if(saved_i >= (int)state->combine_chars_size) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
341 grow_combine_buffer(state); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
342 state->combine_chars[saved_i] = 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
343 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
344 #ifdef DEBUG_GLYPH_COMBINE |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
345 for(; state->combine_chars[printpos]; printpos++) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
346 printf("U+%04x ", state->combine_chars[printpos]); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
347 printf("}\n"); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
348 #endif |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
349 |
20518
a4652d7ec99f
patch 8.2.0813: libvterm code is slightly different from upstream
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
350 /* Now render it */ |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
351 putglyph(state, state->combine_chars, state->combine_width, state->combine_pos); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
352 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
353 else { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
354 DEBUG_LOG("libvterm: TODO: Skip over split char+combining\n"); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
355 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
356 } |
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 for(; i < npoints; i++) { |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
359 // Try to find combining characters following this |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
360 int glyph_starts = i; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
361 int glyph_ends; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
362 int width = 0; |
30876
2d2758ffd959
patch 9.0.0772: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26272
diff
changeset
|
363 |
2d2758ffd959
patch 9.0.0772: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26272
diff
changeset
|
364 for(glyph_ends = i + 1; |
2d2758ffd959
patch 9.0.0772: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26272
diff
changeset
|
365 (glyph_ends < npoints) && (glyph_ends < glyph_starts + VTERM_MAX_CHARS_PER_CELL); |
2d2758ffd959
patch 9.0.0772: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26272
diff
changeset
|
366 glyph_ends++) |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
367 if(!vterm_unicode_is_combining(codepoints[glyph_ends])) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
368 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
369 |
30876
2d2758ffd959
patch 9.0.0772: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26272
diff
changeset
|
370 uint32_t *chars = vterm_allocator_malloc(state->vt, (VTERM_MAX_CHARS_PER_CELL + 1) * sizeof(uint32_t)); |
16429
a1229400434a
patch 8.1.1219: not checking for NULL return from alloc()
Bram Moolenaar <Bram@vim.org>
parents:
16241
diff
changeset
|
371 if (chars == NULL) |
a1229400434a
patch 8.1.1219: not checking for NULL return from alloc()
Bram Moolenaar <Bram@vim.org>
parents:
16241
diff
changeset
|
372 break; |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
373 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
374 for( ; i < glyph_ends; i++) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
375 int this_width; |
18064
8b4f9be5db73
patch 8.1.2027: MS-Windows: problem with ambiwidth characters
Bram Moolenaar <Bram@vim.org>
parents:
17777
diff
changeset
|
376 if(vterm_get_special_pty_type() == 2) { |
8b4f9be5db73
patch 8.1.2027: MS-Windows: problem with ambiwidth characters
Bram Moolenaar <Bram@vim.org>
parents:
17777
diff
changeset
|
377 state->vt->in_backspace -= (state->vt->in_backspace > 0) ? 1 : 0; |
8b4f9be5db73
patch 8.1.2027: MS-Windows: problem with ambiwidth characters
Bram Moolenaar <Bram@vim.org>
parents:
17777
diff
changeset
|
378 if(state->vt->in_backspace == 1) |
8b4f9be5db73
patch 8.1.2027: MS-Windows: problem with ambiwidth characters
Bram Moolenaar <Bram@vim.org>
parents:
17777
diff
changeset
|
379 codepoints[i] = 0; // codepoints under this condition must be 0 |
8b4f9be5db73
patch 8.1.2027: MS-Windows: problem with ambiwidth characters
Bram Moolenaar <Bram@vim.org>
parents:
17777
diff
changeset
|
380 } |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
381 chars[i - glyph_starts] = codepoints[i]; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
382 this_width = vterm_unicode_width(codepoints[i]); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
383 #ifdef DEBUG |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
384 if(this_width < 0) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
385 fprintf(stderr, "Text with negative-width codepoint U+%04x\n", codepoints[i]); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
386 abort(); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
387 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
388 #endif |
23890
57c71d51e937
patch 8.2.2487: terminal shows garbage after double-wide character
Bram Moolenaar <Bram@vim.org>
parents:
21749
diff
changeset
|
389 if (i == glyph_starts || this_width > width) |
30880
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
390 width = this_width; // TODO: should be += ? |
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 |
30880
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
393 while(i < npoints && vterm_unicode_is_combining(codepoints[i])) |
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
394 i++; |
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
395 |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
396 chars[glyph_ends - glyph_starts] = 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
397 i--; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
398 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
399 #ifdef DEBUG_GLYPH_COMBINE |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
400 int printpos; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
401 printf("DEBUG: COMBINED GLYPH of %d chars {", glyph_ends - glyph_starts); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
402 for(printpos = 0; printpos < glyph_ends - glyph_starts; printpos++) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
403 printf("U+%04x ", chars[printpos]); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
404 printf("}, onscreen width %d\n", width); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
405 #endif |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
406 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
407 if(state->at_phantom || state->pos.col + width > THISROWWIDTH(state)) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
408 linefeed(state); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
409 state->pos.col = 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
410 state->at_phantom = 0; |
20482
dc88c690f19b
patch 8.2.0795: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20480
diff
changeset
|
411 state->lineinfo[state->pos.row].continuation = 1; |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
412 } |
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(state->mode.insert) { |
17777
811a12a78164
patch 8.1.1885: comments in libvterm are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
16435
diff
changeset
|
415 // TODO: This will be a little inefficient for large bodies of text, as |
811a12a78164
patch 8.1.1885: comments in libvterm are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
16435
diff
changeset
|
416 // it'll have to 'ICH' effectively before every glyph. We should scan |
811a12a78164
patch 8.1.1885: comments in libvterm are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
16435
diff
changeset
|
417 // ahead and ICH as many times as required |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
418 VTermRect rect; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
419 rect.start_row = state->pos.row; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
420 rect.end_row = state->pos.row + 1; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
421 rect.start_col = state->pos.col; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
422 rect.end_col = THISROWWIDTH(state); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
423 scroll(state, rect, 0, -1); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
424 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
425 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
426 putglyph(state, chars, width, state->pos); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
427 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
428 if(i == npoints - 1) { |
20518
a4652d7ec99f
patch 8.2.0813: libvterm code is slightly different from upstream
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
429 /* End of the buffer. Save the chars in case we have to combine with |
a4652d7ec99f
patch 8.2.0813: libvterm code is slightly different from upstream
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
430 * more on the next call */ |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
431 int save_i; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
432 for(save_i = 0; chars[save_i]; save_i++) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
433 if(save_i >= (int)state->combine_chars_size) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
434 grow_combine_buffer(state); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
435 state->combine_chars[save_i] = chars[save_i]; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
436 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
437 if(save_i >= (int)state->combine_chars_size) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
438 grow_combine_buffer(state); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
439 state->combine_chars[save_i] = 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
440 state->combine_width = width; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
441 state->combine_pos = state->pos; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
442 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
443 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
444 if(state->pos.col + width >= THISROWWIDTH(state)) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
445 if(state->mode.autowrap) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
446 state->at_phantom = 1; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
447 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
448 else { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
449 state->pos.col += width; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
450 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
451 vterm_allocator_free(state->vt, chars); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
452 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
453 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
454 updatecursor(state, &oldpos, 0); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
455 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
456 #ifdef DEBUG |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
457 if(state->pos.row < 0 || state->pos.row >= state->rows || |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
458 state->pos.col < 0 || state->pos.col >= state->cols) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
459 fprintf(stderr, "Position out of bounds after text: (%d,%d)\n", |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
460 state->pos.row, state->pos.col); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
461 abort(); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
462 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
463 #endif |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
464 |
11790
4dfebc1b2674
patch 8.0.0777: compiler warnings with 64 bit compiler
Christian Brabandt <cb@256bit.org>
parents:
11761
diff
changeset
|
465 return (int)eaten; |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
466 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
467 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
468 static int on_control(unsigned char control, void *user) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
469 { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
470 VTermState *state = user; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
471 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
472 VTermPos oldpos = state->pos; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
473 |
18064
8b4f9be5db73
patch 8.1.2027: MS-Windows: problem with ambiwidth characters
Bram Moolenaar <Bram@vim.org>
parents:
17777
diff
changeset
|
474 VTermScreenCell cell; |
8b4f9be5db73
patch 8.1.2027: MS-Windows: problem with ambiwidth characters
Bram Moolenaar <Bram@vim.org>
parents:
17777
diff
changeset
|
475 |
8b4f9be5db73
patch 8.1.2027: MS-Windows: problem with ambiwidth characters
Bram Moolenaar <Bram@vim.org>
parents:
17777
diff
changeset
|
476 // Preparing to see the leading byte |
8b4f9be5db73
patch 8.1.2027: MS-Windows: problem with ambiwidth characters
Bram Moolenaar <Bram@vim.org>
parents:
17777
diff
changeset
|
477 VTermPos leadpos = state->pos; |
8b4f9be5db73
patch 8.1.2027: MS-Windows: problem with ambiwidth characters
Bram Moolenaar <Bram@vim.org>
parents:
17777
diff
changeset
|
478 leadpos.col -= (leadpos.col >= 2 ? 2 : 0); |
8b4f9be5db73
patch 8.1.2027: MS-Windows: problem with ambiwidth characters
Bram Moolenaar <Bram@vim.org>
parents:
17777
diff
changeset
|
479 |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
480 switch(control) { |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
481 case 0x07: // BEL - ECMA-48 8.3.3 |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
482 if(state->callbacks && state->callbacks->bell) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
483 (*state->callbacks->bell)(state->cbdata); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
484 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
485 |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
486 case 0x08: // BS - ECMA-48 8.3.5 |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
487 if(state->pos.col > 0) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
488 state->pos.col--; |
18064
8b4f9be5db73
patch 8.1.2027: MS-Windows: problem with ambiwidth characters
Bram Moolenaar <Bram@vim.org>
parents:
17777
diff
changeset
|
489 if(vterm_get_special_pty_type() == 2) { |
8b4f9be5db73
patch 8.1.2027: MS-Windows: problem with ambiwidth characters
Bram Moolenaar <Bram@vim.org>
parents:
17777
diff
changeset
|
490 // In 2 cell letters, go back 2 cells |
8b4f9be5db73
patch 8.1.2027: MS-Windows: problem with ambiwidth characters
Bram Moolenaar <Bram@vim.org>
parents:
17777
diff
changeset
|
491 vterm_screen_get_cell(state->vt->screen, leadpos, &cell); |
8b4f9be5db73
patch 8.1.2027: MS-Windows: problem with ambiwidth characters
Bram Moolenaar <Bram@vim.org>
parents:
17777
diff
changeset
|
492 if(vterm_unicode_width(cell.chars[0]) == 2) |
8b4f9be5db73
patch 8.1.2027: MS-Windows: problem with ambiwidth characters
Bram Moolenaar <Bram@vim.org>
parents:
17777
diff
changeset
|
493 state->pos.col--; |
8b4f9be5db73
patch 8.1.2027: MS-Windows: problem with ambiwidth characters
Bram Moolenaar <Bram@vim.org>
parents:
17777
diff
changeset
|
494 } |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
495 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
496 |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
497 case 0x09: // HT - ECMA-48 8.3.60 |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
498 tab(state, 1, +1); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
499 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
500 |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
501 case 0x0a: // LF - ECMA-48 8.3.74 |
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
502 case 0x0b: // VT |
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
503 case 0x0c: // FF |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
504 linefeed(state); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
505 if(state->mode.newline) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
506 state->pos.col = 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
507 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
508 |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
509 case 0x0d: // CR - ECMA-48 8.3.15 |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
510 state->pos.col = 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
511 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
512 |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
513 case 0x0e: // LS1 - ECMA-48 8.3.76 |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
514 state->gl_set = 1; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
515 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
516 |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
517 case 0x0f: // LS0 - ECMA-48 8.3.75 |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
518 state->gl_set = 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
519 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
520 |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
521 case 0x84: // IND - DEPRECATED but implemented for completeness |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
522 linefeed(state); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
523 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
524 |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
525 case 0x85: // NEL - ECMA-48 8.3.86 |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
526 linefeed(state); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
527 state->pos.col = 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
528 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
529 |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
530 case 0x88: // HTS - ECMA-48 8.3.62 |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
531 set_col_tabstop(state, state->pos.col); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
532 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
533 |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
534 case 0x8d: // RI - ECMA-48 8.3.104 |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
535 if(state->pos.row == state->scrollregion_top) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
536 VTermRect rect; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
537 rect.start_row = state->scrollregion_top; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
538 rect.end_row = SCROLLREGION_BOTTOM(state); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
539 rect.start_col = SCROLLREGION_LEFT(state); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
540 rect.end_col = SCROLLREGION_RIGHT(state); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
541 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
542 scroll(state, rect, -1, 0); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
543 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
544 else if(state->pos.row > 0) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
545 state->pos.row--; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
546 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
547 |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
548 case 0x8e: // SS2 - ECMA-48 8.3.141 |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
549 state->gsingle_set = 2; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
550 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
551 |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
552 case 0x8f: // SS3 - ECMA-48 8.3.142 |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
553 state->gsingle_set = 3; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
554 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
555 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
556 default: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
557 if(state->fallbacks && state->fallbacks->control) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
558 if((*state->fallbacks->control)(control, state->fbdata)) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
559 return 1; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
560 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
561 return 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
562 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
563 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
564 updatecursor(state, &oldpos, 1); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
565 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
566 #ifdef DEBUG |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
567 if(state->pos.row < 0 || state->pos.row >= state->rows || |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
568 state->pos.col < 0 || state->pos.col >= state->cols) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
569 fprintf(stderr, "Position out of bounds after Ctrl %02x: (%d,%d)\n", |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
570 control, state->pos.row, state->pos.col); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
571 abort(); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
572 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
573 #endif |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
574 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
575 return 1; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
576 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
577 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
578 static int settermprop_bool(VTermState *state, VTermProp prop, int v) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
579 { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
580 VTermValue val; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
581 val.boolean = v; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
582 return vterm_state_set_termprop(state, prop, &val); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
583 } |
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 static int settermprop_int(VTermState *state, VTermProp prop, int v) |
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 VTermValue val; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
588 val.number = v; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
589 return vterm_state_set_termprop(state, prop, &val); |
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 |
20488
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
592 static int settermprop_string(VTermState *state, VTermProp prop, VTermStringFragment frag) |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
593 { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
594 VTermValue val; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
595 |
20488
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
596 val.string = frag; |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
597 return vterm_state_set_termprop(state, prop, &val); |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
598 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
599 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
600 static void savecursor(VTermState *state, int save) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
601 { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
602 if(save) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
603 state->saved.pos = state->pos; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
604 state->saved.mode.cursor_visible = state->mode.cursor_visible; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
605 state->saved.mode.cursor_blink = state->mode.cursor_blink; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
606 state->saved.mode.cursor_shape = state->mode.cursor_shape; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
607 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
608 vterm_state_savepen(state, 1); |
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 else { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
611 VTermPos oldpos = state->pos; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
612 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
613 state->pos = state->saved.pos; |
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 settermprop_bool(state, VTERM_PROP_CURSORVISIBLE, state->saved.mode.cursor_visible); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
616 settermprop_bool(state, VTERM_PROP_CURSORBLINK, state->saved.mode.cursor_blink); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
617 settermprop_int (state, VTERM_PROP_CURSORSHAPE, state->saved.mode.cursor_shape); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
618 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
619 vterm_state_savepen(state, 0); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
620 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
621 updatecursor(state, &oldpos, 1); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
622 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
623 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
624 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
625 static int on_escape(const char *bytes, size_t len, void *user) |
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 VTermState *state = user; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
628 |
20518
a4652d7ec99f
patch 8.2.0813: libvterm code is slightly different from upstream
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
629 /* Easier to decode this from the first byte, even though the final |
a4652d7ec99f
patch 8.2.0813: libvterm code is slightly different from upstream
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
630 * byte terminates it |
a4652d7ec99f
patch 8.2.0813: libvterm code is slightly different from upstream
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
631 */ |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
632 switch(bytes[0]) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
633 case ' ': |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
634 if(len != 2) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
635 return 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
636 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
637 switch(bytes[1]) { |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
638 case 'F': // S7C1T |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
639 state->vt->mode.ctrl8bit = 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
640 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
641 |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
642 case 'G': // S8C1T |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
643 state->vt->mode.ctrl8bit = 1; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
644 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
645 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
646 default: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
647 return 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
648 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
649 return 2; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
650 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
651 case '#': |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
652 if(len != 2) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
653 return 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
654 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
655 switch(bytes[1]) { |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
656 case '3': // DECDHL top |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
657 if(state->mode.leftrightmargin) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
658 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
659 set_lineinfo(state, state->pos.row, NO_FORCE, DWL_ON, DHL_TOP); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
660 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
661 |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
662 case '4': // DECDHL bottom |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
663 if(state->mode.leftrightmargin) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
664 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
665 set_lineinfo(state, state->pos.row, NO_FORCE, DWL_ON, DHL_BOTTOM); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
666 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
667 |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
668 case '5': // DECSWL |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
669 if(state->mode.leftrightmargin) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
670 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
671 set_lineinfo(state, state->pos.row, NO_FORCE, DWL_OFF, DHL_OFF); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
672 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
673 |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
674 case '6': // DECDWL |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
675 if(state->mode.leftrightmargin) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
676 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
677 set_lineinfo(state, state->pos.row, NO_FORCE, DWL_ON, DHL_OFF); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
678 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
679 |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
680 case '8': // DECALN |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
681 { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
682 VTermPos pos; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
683 uint32_t E[] = { 'E', 0 }; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
684 for(pos.row = 0; pos.row < state->rows; pos.row++) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
685 for(pos.col = 0; pos.col < ROWWIDTH(state, pos.row); pos.col++) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
686 putglyph(state, E, 1, pos); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
687 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
688 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
689 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
690 default: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
691 return 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
692 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
693 return 2; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
694 |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
695 case '(': case ')': case '*': case '+': // SCS |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
696 if(len != 2) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
697 return 0; |
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 int setnum = bytes[0] - 0x28; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
701 VTermEncoding *newenc = vterm_lookup_encoding(ENC_SINGLE_94, bytes[1]); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
702 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
703 if(newenc) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
704 state->encoding[setnum].enc = newenc; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
705 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
706 if(newenc->init) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
707 (*newenc->init)(newenc, state->encoding[setnum].data); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
708 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
709 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
710 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
711 return 2; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
712 |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
713 case '7': // DECSC |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
714 savecursor(state, 1); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
715 return 1; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
716 |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
717 case '8': // DECRC |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
718 savecursor(state, 0); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
719 return 1; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
720 |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
721 case '<': // Ignored by VT100. Used in VT52 mode to switch up to VT100 |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
722 return 1; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
723 |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
724 case '=': // DECKPAM |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
725 state->mode.keypad = 1; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
726 return 1; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
727 |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
728 case '>': // DECKPNM |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
729 state->mode.keypad = 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
730 return 1; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
731 |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
732 case 'c': // RIS - ECMA-48 8.3.105 |
11621
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 VTermPos oldpos = state->pos; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
735 vterm_state_reset(state, 1); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
736 if(state->callbacks && state->callbacks->movecursor) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
737 (*state->callbacks->movecursor)(state->pos, oldpos, state->mode.cursor_visible, state->cbdata); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
738 return 1; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
739 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
740 |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
741 case 'n': // LS2 - ECMA-48 8.3.78 |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
742 state->gl_set = 2; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
743 return 1; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
744 |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
745 case 'o': // LS3 - ECMA-48 8.3.80 |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
746 state->gl_set = 3; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
747 return 1; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
748 |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
749 case '~': // LS1R - ECMA-48 8.3.77 |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
750 state->gr_set = 1; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
751 return 1; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
752 |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
753 case '}': // LS2R - ECMA-48 8.3.79 |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
754 state->gr_set = 2; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
755 return 1; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
756 |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
757 case '|': // LS3R - ECMA-48 8.3.81 |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
758 state->gr_set = 3; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
759 return 1; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
760 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
761 default: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
762 return 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
763 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
764 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
765 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
766 static void set_mode(VTermState *state, int num, int val) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
767 { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
768 switch(num) { |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
769 case 4: // IRM - ECMA-48 7.2.10 |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
770 state->mode.insert = val; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
771 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
772 |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
773 case 20: // LNM - ANSI X3.4-1977 |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
774 state->mode.newline = val; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
775 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
776 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
777 default: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
778 DEBUG_LOG1("libvterm: Unknown mode %d\n", num); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
779 return; |
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 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
782 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
783 static void set_dec_mode(VTermState *state, int num, int val) |
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 switch(num) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
786 case 1: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
787 state->mode.cursor = val; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
788 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
789 |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
790 case 5: // DECSCNM - screen mode |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
791 settermprop_bool(state, VTERM_PROP_REVERSE, val); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
792 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
793 |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
794 case 6: // DECOM - origin mode |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
795 { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
796 VTermPos oldpos = state->pos; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
797 state->mode.origin = val; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
798 state->pos.row = state->mode.origin ? state->scrollregion_top : 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
799 state->pos.col = state->mode.origin ? SCROLLREGION_LEFT(state) : 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
800 updatecursor(state, &oldpos, 1); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
801 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
802 break; |
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 case 7: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
805 state->mode.autowrap = val; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
806 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
807 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
808 case 12: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
809 settermprop_bool(state, VTERM_PROP_CURSORBLINK, val); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
810 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
811 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
812 case 25: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
813 settermprop_bool(state, VTERM_PROP_CURSORVISIBLE, val); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
814 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
815 |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
816 case 69: // DECVSSM - vertical split screen mode |
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
817 // DECLRMM - left/right margin mode |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
818 state->mode.leftrightmargin = val; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
819 if(val) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
820 int row; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
821 |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
822 // Setting DECVSSM must clear doublewidth/doubleheight state of every line |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
823 for(row = 0; row < state->rows; row++) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
824 set_lineinfo(state, row, FORCE, DWL_OFF, DHL_OFF); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
825 } |
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 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
828 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
829 case 1000: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
830 case 1002: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
831 case 1003: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
832 settermprop_int(state, VTERM_PROP_MOUSE, |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
833 !val ? VTERM_PROP_MOUSE_NONE : |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
834 (num == 1000) ? VTERM_PROP_MOUSE_CLICK : |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
835 (num == 1002) ? VTERM_PROP_MOUSE_DRAG : |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
836 VTERM_PROP_MOUSE_MOVE); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
837 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
838 |
13531
9f857e6310b6
patch 8.0.1639: libvterm code lags behind master
Christian Brabandt <cb@256bit.org>
parents:
13448
diff
changeset
|
839 case 1004: |
9f857e6310b6
patch 8.0.1639: libvterm code lags behind master
Christian Brabandt <cb@256bit.org>
parents:
13448
diff
changeset
|
840 state->mode.report_focus = val; |
9f857e6310b6
patch 8.0.1639: libvterm code lags behind master
Christian Brabandt <cb@256bit.org>
parents:
13448
diff
changeset
|
841 break; |
9f857e6310b6
patch 8.0.1639: libvterm code lags behind master
Christian Brabandt <cb@256bit.org>
parents:
13448
diff
changeset
|
842 |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
843 case 1005: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
844 state->mouse_protocol = val ? MOUSE_UTF8 : MOUSE_X10; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
845 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
846 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
847 case 1006: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
848 state->mouse_protocol = val ? MOUSE_SGR : MOUSE_X10; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
849 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
850 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
851 case 1015: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
852 state->mouse_protocol = val ? MOUSE_RXVT : MOUSE_X10; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
853 break; |
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 case 1047: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
856 settermprop_bool(state, VTERM_PROP_ALTSCREEN, val); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
857 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
858 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
859 case 1048: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
860 savecursor(state, val); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
861 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
862 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
863 case 1049: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
864 settermprop_bool(state, VTERM_PROP_ALTSCREEN, val); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
865 savecursor(state, val); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
866 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
867 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
868 case 2004: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
869 state->mode.bracketpaste = val; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
870 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
871 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
872 default: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
873 DEBUG_LOG1("libvterm: Unknown DEC mode %d\n", num); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
874 return; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
875 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
876 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
877 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
878 static void request_dec_mode(VTermState *state, int num) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
879 { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
880 int reply; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
881 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
882 switch(num) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
883 case 1: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
884 reply = state->mode.cursor; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
885 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
886 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
887 case 5: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
888 reply = state->mode.screen; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
889 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
890 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
891 case 6: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
892 reply = state->mode.origin; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
893 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
894 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
895 case 7: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
896 reply = state->mode.autowrap; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
897 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
898 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
899 case 12: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
900 reply = state->mode.cursor_blink; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
901 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
902 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
903 case 25: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
904 reply = state->mode.cursor_visible; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
905 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
906 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
907 case 69: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
908 reply = state->mode.leftrightmargin; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
909 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
910 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
911 case 1000: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
912 reply = state->mouse_flags == MOUSE_WANT_CLICK; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
913 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
914 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
915 case 1002: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
916 reply = state->mouse_flags == (MOUSE_WANT_CLICK|MOUSE_WANT_DRAG); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
917 break; |
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 case 1003: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
920 reply = state->mouse_flags == (MOUSE_WANT_CLICK|MOUSE_WANT_MOVE); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
921 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
922 |
13531
9f857e6310b6
patch 8.0.1639: libvterm code lags behind master
Christian Brabandt <cb@256bit.org>
parents:
13448
diff
changeset
|
923 case 1004: |
9f857e6310b6
patch 8.0.1639: libvterm code lags behind master
Christian Brabandt <cb@256bit.org>
parents:
13448
diff
changeset
|
924 reply = state->mode.report_focus; |
9f857e6310b6
patch 8.0.1639: libvterm code lags behind master
Christian Brabandt <cb@256bit.org>
parents:
13448
diff
changeset
|
925 break; |
9f857e6310b6
patch 8.0.1639: libvterm code lags behind master
Christian Brabandt <cb@256bit.org>
parents:
13448
diff
changeset
|
926 |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
927 case 1005: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
928 reply = state->mouse_protocol == MOUSE_UTF8; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
929 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
930 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
931 case 1006: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
932 reply = state->mouse_protocol == MOUSE_SGR; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
933 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
934 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
935 case 1015: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
936 reply = state->mouse_protocol == MOUSE_RXVT; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
937 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
938 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
939 case 1047: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
940 reply = state->mode.alt_screen; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
941 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
942 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
943 case 2004: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
944 reply = state->mode.bracketpaste; |
12365
db99bd23c87f
patch 8.0.1062: Coverity warnings in libvterm
Christian Brabandt <cb@256bit.org>
parents:
12076
diff
changeset
|
945 break; |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
946 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
947 default: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
948 vterm_push_output_sprintf_ctrl(state->vt, C1_CSI, "?%d;%d$y", num, 0); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
949 return; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
950 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
951 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
952 vterm_push_output_sprintf_ctrl(state->vt, C1_CSI, "?%d;%d$y", num, reply ? 1 : 2); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
953 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
954 |
30876
2d2758ffd959
patch 9.0.0772: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26272
diff
changeset
|
955 static void request_version_string(VTermState *state) |
2d2758ffd959
patch 9.0.0772: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26272
diff
changeset
|
956 { |
2d2758ffd959
patch 9.0.0772: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26272
diff
changeset
|
957 vterm_push_output_sprintf_str(state->vt, C1_DCS, TRUE, ">|libvterm(%d.%d)", |
2d2758ffd959
patch 9.0.0772: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26272
diff
changeset
|
958 VTERM_VERSION_MAJOR, VTERM_VERSION_MINOR); |
2d2758ffd959
patch 9.0.0772: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26272
diff
changeset
|
959 } |
2d2758ffd959
patch 9.0.0772: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26272
diff
changeset
|
960 |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
961 static int on_csi(const char *leader, const long args[], int argcount, const char *intermed, char command, void *user) |
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 VTermState *state = user; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
964 int leader_byte = 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
965 int intermed_byte = 0; |
20448
89fade12827d
patch 8.2.0778: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
18279
diff
changeset
|
966 int cancel_phantom = 1; |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
967 VTermPos oldpos = state->pos; |
16241
c1698187c482
patch 8.1.1125: libvterm does not handle the window position report
Bram Moolenaar <Bram@vim.org>
parents:
15249
diff
changeset
|
968 int handled = 1; |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
969 |
17777
811a12a78164
patch 8.1.1885: comments in libvterm are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
16435
diff
changeset
|
970 // Some temporaries for later code |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
971 int count, val; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
972 int row, col; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
973 VTermRect rect; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
974 int selective; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
975 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
976 if(leader && leader[0]) { |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
977 if(leader[1]) // longer than 1 char |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
978 return 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
979 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
980 switch(leader[0]) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
981 case '?': |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
982 case '>': |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
983 leader_byte = leader[0]; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
984 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
985 default: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
986 return 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
987 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
988 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
989 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
990 if(intermed && intermed[0]) { |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
991 if(intermed[1]) // longer than 1 char |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
992 return 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
993 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
994 switch(intermed[0]) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
995 case ' ': |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
996 case '"': |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
997 case '$': |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
998 case '\'': |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
999 intermed_byte = intermed[0]; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1000 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1001 default: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1002 return 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1003 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1004 } |
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 oldpos = state->pos; |
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 #define LBOUND(v,min) if((v) < (min)) (v) = (min) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1009 #define UBOUND(v,max) if((v) > (max)) (v) = (max) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1010 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1011 #define LEADER(l,b) ((l << 8) | b) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1012 #define INTERMED(i,b) ((i << 16) | b) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1013 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1014 switch(intermed_byte << 16 | leader_byte << 8 | command) { |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
1015 case 0x40: // ICH - ECMA-48 8.3.64 |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1016 count = CSI_ARG_COUNT(args[0]); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1017 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1018 if(!is_cursor_in_scrollregion(state)) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1019 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1020 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1021 rect.start_row = state->pos.row; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1022 rect.end_row = state->pos.row + 1; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1023 rect.start_col = state->pos.col; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1024 if(state->mode.leftrightmargin) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1025 rect.end_col = SCROLLREGION_RIGHT(state); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1026 else |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1027 rect.end_col = THISROWWIDTH(state); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1028 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1029 scroll(state, rect, 0, -count); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1030 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1031 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1032 |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
1033 case 0x41: // CUU - ECMA-48 8.3.22 |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1034 count = CSI_ARG_COUNT(args[0]); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1035 state->pos.row -= count; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1036 state->at_phantom = 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1037 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1038 |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
1039 case 0x42: // CUD - ECMA-48 8.3.19 |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1040 count = CSI_ARG_COUNT(args[0]); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1041 state->pos.row += count; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1042 state->at_phantom = 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1043 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1044 |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
1045 case 0x43: // CUF - ECMA-48 8.3.20 |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1046 count = CSI_ARG_COUNT(args[0]); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1047 state->pos.col += count; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1048 state->at_phantom = 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1049 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1050 |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
1051 case 0x44: // CUB - ECMA-48 8.3.18 |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1052 count = CSI_ARG_COUNT(args[0]); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1053 state->pos.col -= count; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1054 state->at_phantom = 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1055 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1056 |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
1057 case 0x45: // CNL - ECMA-48 8.3.12 |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1058 count = CSI_ARG_COUNT(args[0]); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1059 state->pos.col = 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1060 state->pos.row += count; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1061 state->at_phantom = 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1062 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1063 |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
1064 case 0x46: // CPL - ECMA-48 8.3.13 |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1065 count = CSI_ARG_COUNT(args[0]); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1066 state->pos.col = 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1067 state->pos.row -= count; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1068 state->at_phantom = 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1069 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1070 |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
1071 case 0x47: // CHA - ECMA-48 8.3.9 |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1072 val = CSI_ARG_OR(args[0], 1); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1073 state->pos.col = val-1; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1074 state->at_phantom = 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1075 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1076 |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
1077 case 0x48: // CUP - ECMA-48 8.3.21 |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1078 row = CSI_ARG_OR(args[0], 1); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1079 col = argcount < 2 || CSI_ARG_IS_MISSING(args[1]) ? 1 : CSI_ARG(args[1]); |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
1080 // zero-based |
18064
8b4f9be5db73
patch 8.1.2027: MS-Windows: problem with ambiwidth characters
Bram Moolenaar <Bram@vim.org>
parents:
17777
diff
changeset
|
1081 if(vterm_get_special_pty_type() == 2) { |
8b4f9be5db73
patch 8.1.2027: MS-Windows: problem with ambiwidth characters
Bram Moolenaar <Bram@vim.org>
parents:
17777
diff
changeset
|
1082 // Fix a sequence that is not correct right now |
8b4f9be5db73
patch 8.1.2027: MS-Windows: problem with ambiwidth characters
Bram Moolenaar <Bram@vim.org>
parents:
17777
diff
changeset
|
1083 if(state->pos.row == row - 1) { |
8b4f9be5db73
patch 8.1.2027: MS-Windows: problem with ambiwidth characters
Bram Moolenaar <Bram@vim.org>
parents:
17777
diff
changeset
|
1084 int cnt, ptr = 0; |
8b4f9be5db73
patch 8.1.2027: MS-Windows: problem with ambiwidth characters
Bram Moolenaar <Bram@vim.org>
parents:
17777
diff
changeset
|
1085 for(cnt = 0; cnt < col - 1; ++cnt) { |
8b4f9be5db73
patch 8.1.2027: MS-Windows: problem with ambiwidth characters
Bram Moolenaar <Bram@vim.org>
parents:
17777
diff
changeset
|
1086 VTermPos p; |
8b4f9be5db73
patch 8.1.2027: MS-Windows: problem with ambiwidth characters
Bram Moolenaar <Bram@vim.org>
parents:
17777
diff
changeset
|
1087 VTermScreenCell c0, c1; |
8b4f9be5db73
patch 8.1.2027: MS-Windows: problem with ambiwidth characters
Bram Moolenaar <Bram@vim.org>
parents:
17777
diff
changeset
|
1088 p.row = row - 1; |
8b4f9be5db73
patch 8.1.2027: MS-Windows: problem with ambiwidth characters
Bram Moolenaar <Bram@vim.org>
parents:
17777
diff
changeset
|
1089 p.col = ptr; |
8b4f9be5db73
patch 8.1.2027: MS-Windows: problem with ambiwidth characters
Bram Moolenaar <Bram@vim.org>
parents:
17777
diff
changeset
|
1090 vterm_screen_get_cell(state->vt->screen, p, &c0); |
8b4f9be5db73
patch 8.1.2027: MS-Windows: problem with ambiwidth characters
Bram Moolenaar <Bram@vim.org>
parents:
17777
diff
changeset
|
1091 p.col++; |
8b4f9be5db73
patch 8.1.2027: MS-Windows: problem with ambiwidth characters
Bram Moolenaar <Bram@vim.org>
parents:
17777
diff
changeset
|
1092 vterm_screen_get_cell(state->vt->screen, p, &c1); |
8b4f9be5db73
patch 8.1.2027: MS-Windows: problem with ambiwidth characters
Bram Moolenaar <Bram@vim.org>
parents:
17777
diff
changeset
|
1093 ptr += (c1.chars[0] == (uint32_t)-1) // double cell? |
8b4f9be5db73
patch 8.1.2027: MS-Windows: problem with ambiwidth characters
Bram Moolenaar <Bram@vim.org>
parents:
17777
diff
changeset
|
1094 ? (vterm_unicode_is_ambiguous(c0.chars[0])) // is ambiguous? |
8b4f9be5db73
patch 8.1.2027: MS-Windows: problem with ambiwidth characters
Bram Moolenaar <Bram@vim.org>
parents:
17777
diff
changeset
|
1095 ? vterm_unicode_width(0x00a1) : 1 // &ambiwidth |
8b4f9be5db73
patch 8.1.2027: MS-Windows: problem with ambiwidth characters
Bram Moolenaar <Bram@vim.org>
parents:
17777
diff
changeset
|
1096 : 1; // not ambiguous |
8b4f9be5db73
patch 8.1.2027: MS-Windows: problem with ambiwidth characters
Bram Moolenaar <Bram@vim.org>
parents:
17777
diff
changeset
|
1097 } |
8b4f9be5db73
patch 8.1.2027: MS-Windows: problem with ambiwidth characters
Bram Moolenaar <Bram@vim.org>
parents:
17777
diff
changeset
|
1098 col = ptr + 1; |
8b4f9be5db73
patch 8.1.2027: MS-Windows: problem with ambiwidth characters
Bram Moolenaar <Bram@vim.org>
parents:
17777
diff
changeset
|
1099 } |
8b4f9be5db73
patch 8.1.2027: MS-Windows: problem with ambiwidth characters
Bram Moolenaar <Bram@vim.org>
parents:
17777
diff
changeset
|
1100 } |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1101 state->pos.row = row-1; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1102 state->pos.col = col-1; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1103 if(state->mode.origin) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1104 state->pos.row += state->scrollregion_top; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1105 state->pos.col += SCROLLREGION_LEFT(state); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1106 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1107 state->at_phantom = 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1108 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1109 |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
1110 case 0x49: // CHT - ECMA-48 8.3.10 |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1111 count = CSI_ARG_COUNT(args[0]); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1112 tab(state, count, +1); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1113 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1114 |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
1115 case 0x4a: // ED - ECMA-48 8.3.39 |
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
1116 case LEADER('?', 0x4a): // DECSED - Selective Erase in Display |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1117 selective = (leader_byte == '?'); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1118 switch(CSI_ARG(args[0])) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1119 case CSI_ARG_MISSING: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1120 case 0: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1121 rect.start_row = state->pos.row; rect.end_row = state->pos.row + 1; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1122 rect.start_col = state->pos.col; rect.end_col = state->cols; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1123 if(rect.end_col > rect.start_col) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1124 erase(state, rect, selective); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1125 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1126 rect.start_row = state->pos.row + 1; rect.end_row = state->rows; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1127 rect.start_col = 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1128 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
|
1129 set_lineinfo(state, row, FORCE, DWL_OFF, DHL_OFF); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1130 if(rect.end_row > rect.start_row) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1131 erase(state, rect, selective); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1132 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1133 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1134 case 1: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1135 rect.start_row = 0; rect.end_row = state->pos.row; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1136 rect.start_col = 0; rect.end_col = state->cols; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1137 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
|
1138 set_lineinfo(state, row, FORCE, DWL_OFF, DHL_OFF); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1139 if(rect.end_col > rect.start_col) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1140 erase(state, rect, selective); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1141 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1142 rect.start_row = state->pos.row; rect.end_row = state->pos.row + 1; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1143 rect.end_col = state->pos.col + 1; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1144 if(rect.end_row > rect.start_row) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1145 erase(state, rect, selective); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1146 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1147 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1148 case 2: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1149 rect.start_row = 0; rect.end_row = state->rows; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1150 rect.start_col = 0; rect.end_col = state->cols; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1151 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
|
1152 set_lineinfo(state, row, FORCE, DWL_OFF, DHL_OFF); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1153 erase(state, rect, selective); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1154 break; |
30880
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
1155 |
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
1156 case 3: |
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
1157 if(state->callbacks && state->callbacks->sb_clear) |
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
1158 if((*state->callbacks->sb_clear)(state->cbdata)) |
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
1159 return 1; |
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
1160 break; |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1161 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1162 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1163 |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
1164 case 0x4b: // EL - ECMA-48 8.3.41 |
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
1165 case LEADER('?', 0x4b): // DECSEL - Selective Erase in Line |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1166 selective = (leader_byte == '?'); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1167 rect.start_row = state->pos.row; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1168 rect.end_row = state->pos.row + 1; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1169 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1170 switch(CSI_ARG(args[0])) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1171 case CSI_ARG_MISSING: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1172 case 0: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1173 rect.start_col = state->pos.col; rect.end_col = THISROWWIDTH(state); break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1174 case 1: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1175 rect.start_col = 0; rect.end_col = state->pos.col + 1; break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1176 case 2: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1177 rect.start_col = 0; rect.end_col = THISROWWIDTH(state); break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1178 default: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1179 return 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1180 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1181 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1182 if(rect.end_col > rect.start_col) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1183 erase(state, rect, selective); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1184 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1185 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1186 |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
1187 case 0x4c: // IL - ECMA-48 8.3.67 |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1188 count = CSI_ARG_COUNT(args[0]); |
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(!is_cursor_in_scrollregion(state)) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1191 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1192 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1193 rect.start_row = state->pos.row; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1194 rect.end_row = SCROLLREGION_BOTTOM(state); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1195 rect.start_col = SCROLLREGION_LEFT(state); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1196 rect.end_col = SCROLLREGION_RIGHT(state); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1197 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1198 scroll(state, rect, -count, 0); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1199 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1200 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1201 |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
1202 case 0x4d: // DL - ECMA-48 8.3.32 |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1203 count = CSI_ARG_COUNT(args[0]); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1204 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1205 if(!is_cursor_in_scrollregion(state)) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1206 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1207 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1208 rect.start_row = state->pos.row; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1209 rect.end_row = SCROLLREGION_BOTTOM(state); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1210 rect.start_col = SCROLLREGION_LEFT(state); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1211 rect.end_col = SCROLLREGION_RIGHT(state); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1212 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1213 scroll(state, rect, count, 0); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1214 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1215 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1216 |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
1217 case 0x50: // DCH - ECMA-48 8.3.26 |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1218 count = CSI_ARG_COUNT(args[0]); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1219 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1220 if(!is_cursor_in_scrollregion(state)) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1221 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1222 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1223 rect.start_row = state->pos.row; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1224 rect.end_row = state->pos.row + 1; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1225 rect.start_col = state->pos.col; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1226 if(state->mode.leftrightmargin) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1227 rect.end_col = SCROLLREGION_RIGHT(state); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1228 else |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1229 rect.end_col = THISROWWIDTH(state); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1230 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1231 scroll(state, rect, 0, count); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1232 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1233 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1234 |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
1235 case 0x53: // SU - ECMA-48 8.3.147 |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1236 count = CSI_ARG_COUNT(args[0]); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1237 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1238 rect.start_row = state->scrollregion_top; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1239 rect.end_row = SCROLLREGION_BOTTOM(state); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1240 rect.start_col = SCROLLREGION_LEFT(state); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1241 rect.end_col = SCROLLREGION_RIGHT(state); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1242 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1243 scroll(state, rect, count, 0); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1244 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1245 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1246 |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
1247 case 0x54: // SD - ECMA-48 8.3.113 |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1248 count = CSI_ARG_COUNT(args[0]); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1249 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1250 rect.start_row = state->scrollregion_top; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1251 rect.end_row = SCROLLREGION_BOTTOM(state); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1252 rect.start_col = SCROLLREGION_LEFT(state); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1253 rect.end_col = SCROLLREGION_RIGHT(state); |
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 scroll(state, rect, -count, 0); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1256 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1257 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1258 |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
1259 case 0x58: // ECH - ECMA-48 8.3.38 |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1260 count = CSI_ARG_COUNT(args[0]); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1261 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1262 rect.start_row = state->pos.row; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1263 rect.end_row = state->pos.row + 1; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1264 rect.start_col = state->pos.col; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1265 rect.end_col = state->pos.col + count; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1266 UBOUND(rect.end_col, THISROWWIDTH(state)); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1267 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1268 erase(state, rect, 0); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1269 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1270 |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
1271 case 0x5a: // CBT - ECMA-48 8.3.7 |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1272 count = CSI_ARG_COUNT(args[0]); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1273 tab(state, count, -1); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1274 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1275 |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
1276 case 0x60: // HPA - ECMA-48 8.3.57 |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1277 col = CSI_ARG_OR(args[0], 1); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1278 state->pos.col = col-1; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1279 state->at_phantom = 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1280 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1281 |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
1282 case 0x61: // HPR - ECMA-48 8.3.59 |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1283 count = CSI_ARG_COUNT(args[0]); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1284 state->pos.col += count; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1285 state->at_phantom = 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1286 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1287 |
20448
89fade12827d
patch 8.2.0778: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
18279
diff
changeset
|
1288 case 0x62: { // REP - ECMA-48 8.3.103 |
89fade12827d
patch 8.2.0778: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
18279
diff
changeset
|
1289 const int row_width = THISROWWIDTH(state); |
89fade12827d
patch 8.2.0778: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
18279
diff
changeset
|
1290 count = CSI_ARG_COUNT(args[0]); |
89fade12827d
patch 8.2.0778: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
18279
diff
changeset
|
1291 col = state->pos.col + count; |
89fade12827d
patch 8.2.0778: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
18279
diff
changeset
|
1292 UBOUND(col, row_width); |
89fade12827d
patch 8.2.0778: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
18279
diff
changeset
|
1293 while (state->pos.col < col) { |
89fade12827d
patch 8.2.0778: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
18279
diff
changeset
|
1294 putglyph(state, state->combine_chars, state->combine_width, state->pos); |
89fade12827d
patch 8.2.0778: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
18279
diff
changeset
|
1295 state->pos.col += state->combine_width; |
89fade12827d
patch 8.2.0778: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
18279
diff
changeset
|
1296 } |
89fade12827d
patch 8.2.0778: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
18279
diff
changeset
|
1297 if (state->pos.col + state->combine_width >= row_width) { |
89fade12827d
patch 8.2.0778: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
18279
diff
changeset
|
1298 if (state->mode.autowrap) { |
89fade12827d
patch 8.2.0778: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
18279
diff
changeset
|
1299 state->at_phantom = 1; |
89fade12827d
patch 8.2.0778: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
18279
diff
changeset
|
1300 cancel_phantom = 0; |
89fade12827d
patch 8.2.0778: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
18279
diff
changeset
|
1301 } |
89fade12827d
patch 8.2.0778: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
18279
diff
changeset
|
1302 } |
89fade12827d
patch 8.2.0778: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
18279
diff
changeset
|
1303 break; |
89fade12827d
patch 8.2.0778: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
18279
diff
changeset
|
1304 } |
89fade12827d
patch 8.2.0778: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
18279
diff
changeset
|
1305 |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
1306 case 0x63: // DA - ECMA-48 8.3.24 |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1307 val = CSI_ARG_OR(args[0], 0); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1308 if(val == 0) |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
1309 // DEC VT100 response |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1310 vterm_push_output_sprintf_ctrl(state->vt, C1_CSI, "?1;2c"); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1311 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1312 |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
1313 case LEADER('>', 0x63): // DEC secondary Device Attributes |
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
1314 // This returns xterm version number 100. |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1315 vterm_push_output_sprintf_ctrl(state->vt, C1_CSI, ">%d;%d;%dc", 0, 100, 0); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1316 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1317 |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
1318 case 0x64: // VPA - ECMA-48 8.3.158 |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1319 row = CSI_ARG_OR(args[0], 1); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1320 state->pos.row = row-1; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1321 if(state->mode.origin) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1322 state->pos.row += state->scrollregion_top; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1323 state->at_phantom = 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1324 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1325 |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
1326 case 0x65: // VPR - ECMA-48 8.3.160 |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1327 count = CSI_ARG_COUNT(args[0]); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1328 state->pos.row += count; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1329 state->at_phantom = 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1330 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1331 |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
1332 case 0x66: // HVP - ECMA-48 8.3.63 |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1333 row = CSI_ARG_OR(args[0], 1); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1334 col = argcount < 2 || CSI_ARG_IS_MISSING(args[1]) ? 1 : CSI_ARG(args[1]); |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
1335 // zero-based |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1336 state->pos.row = row-1; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1337 state->pos.col = col-1; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1338 if(state->mode.origin) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1339 state->pos.row += state->scrollregion_top; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1340 state->pos.col += SCROLLREGION_LEFT(state); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1341 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1342 state->at_phantom = 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1343 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1344 |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
1345 case 0x67: // TBC - ECMA-48 8.3.154 |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1346 val = CSI_ARG_OR(args[0], 0); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1347 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1348 switch(val) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1349 case 0: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1350 clear_col_tabstop(state, state->pos.col); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1351 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1352 case 3: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1353 case 5: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1354 for(col = 0; col < state->cols; col++) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1355 clear_col_tabstop(state, col); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1356 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1357 case 1: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1358 case 2: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1359 case 4: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1360 break; |
20518
a4652d7ec99f
patch 8.2.0813: libvterm code is slightly different from upstream
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
1361 /* TODO: 1, 2 and 4 aren't meaningful yet without line tab stops */ |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1362 default: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1363 return 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1364 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1365 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1366 |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
1367 case 0x68: // SM - ECMA-48 8.3.125 |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1368 if(!CSI_ARG_IS_MISSING(args[0])) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1369 set_mode(state, CSI_ARG(args[0]), 1); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1370 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1371 |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
1372 case LEADER('?', 0x68): // DEC private mode set |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1373 if(!CSI_ARG_IS_MISSING(args[0])) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1374 set_dec_mode(state, CSI_ARG(args[0]), 1); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1375 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1376 |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
1377 case 0x6a: // HPB - ECMA-48 8.3.58 |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1378 count = CSI_ARG_COUNT(args[0]); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1379 state->pos.col -= count; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1380 state->at_phantom = 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1381 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1382 |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
1383 case 0x6b: // VPB - ECMA-48 8.3.159 |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1384 count = CSI_ARG_COUNT(args[0]); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1385 state->pos.row -= count; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1386 state->at_phantom = 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1387 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1388 |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
1389 case 0x6c: // RM - ECMA-48 8.3.106 |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1390 if(!CSI_ARG_IS_MISSING(args[0])) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1391 set_mode(state, CSI_ARG(args[0]), 0); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1392 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1393 |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
1394 case LEADER('?', 0x6c): // DEC private mode reset |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1395 if(!CSI_ARG_IS_MISSING(args[0])) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1396 set_dec_mode(state, CSI_ARG(args[0]), 0); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1397 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1398 |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
1399 case 0x6d: // SGR - ECMA-48 8.3.117 |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1400 vterm_state_setpen(state, args, argcount); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1401 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1402 |
31243
984ebd1f6605
patch 9.0.0955: libvterm does not support the XTQMODKEYS request
Bram Moolenaar <Bram@vim.org>
parents:
31192
diff
changeset
|
1403 case LEADER('?', 0x6d): // DECSGR and XTQMODKEYS |
984ebd1f6605
patch 9.0.0955: libvterm does not support the XTQMODKEYS request
Bram Moolenaar <Bram@vim.org>
parents:
31192
diff
changeset
|
1404 // CSI ? 4 m XTQMODKEYS: request modifyOtherKeys level |
984ebd1f6605
patch 9.0.0955: libvterm does not support the XTQMODKEYS request
Bram Moolenaar <Bram@vim.org>
parents:
31192
diff
changeset
|
1405 if (argcount == 1 && CSI_ARG(args[0]) == 4) |
984ebd1f6605
patch 9.0.0955: libvterm does not support the XTQMODKEYS request
Bram Moolenaar <Bram@vim.org>
parents:
31192
diff
changeset
|
1406 { |
984ebd1f6605
patch 9.0.0955: libvterm does not support the XTQMODKEYS request
Bram Moolenaar <Bram@vim.org>
parents:
31192
diff
changeset
|
1407 vterm_push_output_sprintf_ctrl(state->vt, C1_CSI, ">4;%dm", |
984ebd1f6605
patch 9.0.0955: libvterm does not support the XTQMODKEYS request
Bram Moolenaar <Bram@vim.org>
parents:
31192
diff
changeset
|
1408 state->mode.modify_other_keys ? 2 : 0); |
984ebd1f6605
patch 9.0.0955: libvterm does not support the XTQMODKEYS request
Bram Moolenaar <Bram@vim.org>
parents:
31192
diff
changeset
|
1409 break; |
984ebd1f6605
patch 9.0.0955: libvterm does not support the XTQMODKEYS request
Bram Moolenaar <Bram@vim.org>
parents:
31192
diff
changeset
|
1410 } |
984ebd1f6605
patch 9.0.0955: libvterm does not support the XTQMODKEYS request
Bram Moolenaar <Bram@vim.org>
parents:
31192
diff
changeset
|
1411 |
30880
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
1412 /* No actual DEC terminal recognised these, but some printers did. These |
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
1413 * are alternative ways to request subscript/superscript/off |
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
1414 */ |
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
1415 for(int argi = 0; argi < argcount; argi++) { |
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
1416 long arg; |
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
1417 switch(arg = CSI_ARG(args[argi])) { |
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
1418 case 4: // Superscript on |
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
1419 arg = 73; |
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
1420 vterm_state_setpen(state, &arg, 1); |
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
1421 break; |
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
1422 case 5: // Subscript on |
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
1423 arg = 74; |
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
1424 vterm_state_setpen(state, &arg, 1); |
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
1425 break; |
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
1426 case 24: // Super+subscript off |
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
1427 arg = 75; |
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
1428 vterm_state_setpen(state, &arg, 1); |
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
1429 break; |
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
1430 } |
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
1431 } |
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
1432 break; |
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
1433 |
31192
dcde141f2d1e
patch 9.0.0930: cannot debug the Kitty keyboard protocol with TermDebug
Bram Moolenaar <Bram@vim.org>
parents:
30880
diff
changeset
|
1434 case LEADER('>', 0x6d): // CSI > 4 ; Pv m xterm resource modifyOtherKeys |
31243
984ebd1f6605
patch 9.0.0955: libvterm does not support the XTQMODKEYS request
Bram Moolenaar <Bram@vim.org>
parents:
31192
diff
changeset
|
1435 if (argcount == 2 && CSI_ARG(args[0]) == 4) |
31192
dcde141f2d1e
patch 9.0.0930: cannot debug the Kitty keyboard protocol with TermDebug
Bram Moolenaar <Bram@vim.org>
parents:
30880
diff
changeset
|
1436 { |
dcde141f2d1e
patch 9.0.0930: cannot debug the Kitty keyboard protocol with TermDebug
Bram Moolenaar <Bram@vim.org>
parents:
30880
diff
changeset
|
1437 // can't have both modify_other_keys and kitty_keyboard |
dcde141f2d1e
patch 9.0.0930: cannot debug the Kitty keyboard protocol with TermDebug
Bram Moolenaar <Bram@vim.org>
parents:
30880
diff
changeset
|
1438 state->mode.kitty_keyboard = 0; |
dcde141f2d1e
patch 9.0.0930: cannot debug the Kitty keyboard protocol with TermDebug
Bram Moolenaar <Bram@vim.org>
parents:
30880
diff
changeset
|
1439 |
31243
984ebd1f6605
patch 9.0.0955: libvterm does not support the XTQMODKEYS request
Bram Moolenaar <Bram@vim.org>
parents:
31192
diff
changeset
|
1440 state->mode.modify_other_keys = CSI_ARG(args[1]) == 2; |
31192
dcde141f2d1e
patch 9.0.0930: cannot debug the Kitty keyboard protocol with TermDebug
Bram Moolenaar <Bram@vim.org>
parents:
30880
diff
changeset
|
1441 } |
dcde141f2d1e
patch 9.0.0930: cannot debug the Kitty keyboard protocol with TermDebug
Bram Moolenaar <Bram@vim.org>
parents:
30880
diff
changeset
|
1442 break; |
dcde141f2d1e
patch 9.0.0930: cannot debug the Kitty keyboard protocol with TermDebug
Bram Moolenaar <Bram@vim.org>
parents:
30880
diff
changeset
|
1443 |
dcde141f2d1e
patch 9.0.0930: cannot debug the Kitty keyboard protocol with TermDebug
Bram Moolenaar <Bram@vim.org>
parents:
30880
diff
changeset
|
1444 case LEADER('>', 0x75): // CSI > 1 u enable kitty keyboard protocol |
31243
984ebd1f6605
patch 9.0.0955: libvterm does not support the XTQMODKEYS request
Bram Moolenaar <Bram@vim.org>
parents:
31192
diff
changeset
|
1445 if (argcount == 1 && CSI_ARG(args[0]) == 1) |
31192
dcde141f2d1e
patch 9.0.0930: cannot debug the Kitty keyboard protocol with TermDebug
Bram Moolenaar <Bram@vim.org>
parents:
30880
diff
changeset
|
1446 { |
dcde141f2d1e
patch 9.0.0930: cannot debug the Kitty keyboard protocol with TermDebug
Bram Moolenaar <Bram@vim.org>
parents:
30880
diff
changeset
|
1447 // can't have both modify_other_keys and kitty_keyboard |
dcde141f2d1e
patch 9.0.0930: cannot debug the Kitty keyboard protocol with TermDebug
Bram Moolenaar <Bram@vim.org>
parents:
30880
diff
changeset
|
1448 state->mode.modify_other_keys = 0; |
dcde141f2d1e
patch 9.0.0930: cannot debug the Kitty keyboard protocol with TermDebug
Bram Moolenaar <Bram@vim.org>
parents:
30880
diff
changeset
|
1449 |
dcde141f2d1e
patch 9.0.0930: cannot debug the Kitty keyboard protocol with TermDebug
Bram Moolenaar <Bram@vim.org>
parents:
30880
diff
changeset
|
1450 state->mode.kitty_keyboard = 1; |
dcde141f2d1e
patch 9.0.0930: cannot debug the Kitty keyboard protocol with TermDebug
Bram Moolenaar <Bram@vim.org>
parents:
30880
diff
changeset
|
1451 } |
dcde141f2d1e
patch 9.0.0930: cannot debug the Kitty keyboard protocol with TermDebug
Bram Moolenaar <Bram@vim.org>
parents:
30880
diff
changeset
|
1452 break; |
dcde141f2d1e
patch 9.0.0930: cannot debug the Kitty keyboard protocol with TermDebug
Bram Moolenaar <Bram@vim.org>
parents:
30880
diff
changeset
|
1453 |
dcde141f2d1e
patch 9.0.0930: cannot debug the Kitty keyboard protocol with TermDebug
Bram Moolenaar <Bram@vim.org>
parents:
30880
diff
changeset
|
1454 case LEADER('<', 0x75): // CSI < u disable kitty keyboard protocol |
dcde141f2d1e
patch 9.0.0930: cannot debug the Kitty keyboard protocol with TermDebug
Bram Moolenaar <Bram@vim.org>
parents:
30880
diff
changeset
|
1455 if (argcount <= 1) |
dcde141f2d1e
patch 9.0.0930: cannot debug the Kitty keyboard protocol with TermDebug
Bram Moolenaar <Bram@vim.org>
parents:
30880
diff
changeset
|
1456 state->mode.kitty_keyboard = 0; |
dcde141f2d1e
patch 9.0.0930: cannot debug the Kitty keyboard protocol with TermDebug
Bram Moolenaar <Bram@vim.org>
parents:
30880
diff
changeset
|
1457 break; |
dcde141f2d1e
patch 9.0.0930: cannot debug the Kitty keyboard protocol with TermDebug
Bram Moolenaar <Bram@vim.org>
parents:
30880
diff
changeset
|
1458 |
dcde141f2d1e
patch 9.0.0930: cannot debug the Kitty keyboard protocol with TermDebug
Bram Moolenaar <Bram@vim.org>
parents:
30880
diff
changeset
|
1459 case LEADER('?', 0x75): // CSI ? u request kitty keyboard protocol state |
dcde141f2d1e
patch 9.0.0930: cannot debug the Kitty keyboard protocol with TermDebug
Bram Moolenaar <Bram@vim.org>
parents:
30880
diff
changeset
|
1460 if (argcount <= 1) |
dcde141f2d1e
patch 9.0.0930: cannot debug the Kitty keyboard protocol with TermDebug
Bram Moolenaar <Bram@vim.org>
parents:
30880
diff
changeset
|
1461 // TODO: this only uses the values zero and one. The protocol specifies |
dcde141f2d1e
patch 9.0.0930: cannot debug the Kitty keyboard protocol with TermDebug
Bram Moolenaar <Bram@vim.org>
parents:
30880
diff
changeset
|
1462 // more values, the progressive enhancement flags. |
dcde141f2d1e
patch 9.0.0930: cannot debug the Kitty keyboard protocol with TermDebug
Bram Moolenaar <Bram@vim.org>
parents:
30880
diff
changeset
|
1463 vterm_push_output_sprintf_ctrl(state->vt, C1_CSI, "?%du", |
dcde141f2d1e
patch 9.0.0930: cannot debug the Kitty keyboard protocol with TermDebug
Bram Moolenaar <Bram@vim.org>
parents:
30880
diff
changeset
|
1464 state->mode.kitty_keyboard); |
18279
e8d1f3209dcd
patch 8.1.2134: modifier keys are not always recognized
Bram Moolenaar <Bram@vim.org>
parents:
18064
diff
changeset
|
1465 break; |
e8d1f3209dcd
patch 8.1.2134: modifier keys are not always recognized
Bram Moolenaar <Bram@vim.org>
parents:
18064
diff
changeset
|
1466 |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
1467 case 0x6e: // DSR - ECMA-48 8.3.35 |
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
1468 case LEADER('?', 0x6e): // DECDSR |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1469 val = CSI_ARG_OR(args[0], 0); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1470 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1471 { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1472 char *qmark = (leader_byte == '?') ? "?" : ""; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1473 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1474 switch(val) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1475 case 0: case 1: case 2: case 3: case 4: |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
1476 // ignore - these are replies |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1477 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1478 case 5: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1479 vterm_push_output_sprintf_ctrl(state->vt, C1_CSI, "%s0n", qmark); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1480 break; |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
1481 case 6: // CPR - cursor position report |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1482 vterm_push_output_sprintf_ctrl(state->vt, C1_CSI, "%s%d;%dR", qmark, state->pos.row + 1, state->pos.col + 1); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1483 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1484 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1485 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1486 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1487 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1488 |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
1489 case LEADER('!', 0x70): // DECSTR - DEC soft terminal reset |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1490 vterm_state_reset(state, 0); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1491 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1492 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1493 case LEADER('?', INTERMED('$', 0x70)): |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1494 request_dec_mode(state, CSI_ARG(args[0])); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1495 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1496 |
30876
2d2758ffd959
patch 9.0.0772: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26272
diff
changeset
|
1497 case LEADER('>', 0x71): // XTVERSION - xterm query version string |
2d2758ffd959
patch 9.0.0772: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26272
diff
changeset
|
1498 request_version_string(state); |
2d2758ffd959
patch 9.0.0772: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26272
diff
changeset
|
1499 break; |
2d2758ffd959
patch 9.0.0772: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26272
diff
changeset
|
1500 |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
1501 case INTERMED(' ', 0x71): // DECSCUSR - DEC set cursor shape |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1502 val = CSI_ARG_OR(args[0], 1); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1503 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1504 switch(val) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1505 case 0: case 1: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1506 settermprop_bool(state, VTERM_PROP_CURSORBLINK, 1); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1507 settermprop_int (state, VTERM_PROP_CURSORSHAPE, VTERM_PROP_CURSORSHAPE_BLOCK); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1508 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1509 case 2: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1510 settermprop_bool(state, VTERM_PROP_CURSORBLINK, 0); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1511 settermprop_int (state, VTERM_PROP_CURSORSHAPE, VTERM_PROP_CURSORSHAPE_BLOCK); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1512 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1513 case 3: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1514 settermprop_bool(state, VTERM_PROP_CURSORBLINK, 1); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1515 settermprop_int (state, VTERM_PROP_CURSORSHAPE, VTERM_PROP_CURSORSHAPE_UNDERLINE); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1516 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1517 case 4: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1518 settermprop_bool(state, VTERM_PROP_CURSORBLINK, 0); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1519 settermprop_int (state, VTERM_PROP_CURSORSHAPE, VTERM_PROP_CURSORSHAPE_UNDERLINE); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1520 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1521 case 5: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1522 settermprop_bool(state, VTERM_PROP_CURSORBLINK, 1); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1523 settermprop_int (state, VTERM_PROP_CURSORSHAPE, VTERM_PROP_CURSORSHAPE_BAR_LEFT); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1524 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1525 case 6: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1526 settermprop_bool(state, VTERM_PROP_CURSORBLINK, 0); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1527 settermprop_int (state, VTERM_PROP_CURSORSHAPE, VTERM_PROP_CURSORSHAPE_BAR_LEFT); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1528 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1529 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1530 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1531 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1532 |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
1533 case INTERMED('"', 0x71): // DECSCA - DEC select character protection attribute |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1534 val = CSI_ARG_OR(args[0], 0); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1535 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1536 switch(val) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1537 case 0: case 2: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1538 state->protected_cell = 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1539 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1540 case 1: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1541 state->protected_cell = 1; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1542 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1543 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1544 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1545 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1546 |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
1547 case 0x72: // DECSTBM - DEC custom |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1548 state->scrollregion_top = CSI_ARG_OR(args[0], 1) - 1; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1549 state->scrollregion_bottom = argcount < 2 || CSI_ARG_IS_MISSING(args[1]) ? -1 : CSI_ARG(args[1]); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1550 LBOUND(state->scrollregion_top, 0); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1551 UBOUND(state->scrollregion_top, state->rows); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1552 LBOUND(state->scrollregion_bottom, -1); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1553 if(state->scrollregion_top == 0 && state->scrollregion_bottom == state->rows) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1554 state->scrollregion_bottom = -1; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1555 else |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1556 UBOUND(state->scrollregion_bottom, state->rows); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1557 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1558 if(SCROLLREGION_BOTTOM(state) <= state->scrollregion_top) { |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
1559 // Invalid |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1560 state->scrollregion_top = 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1561 state->scrollregion_bottom = -1; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1562 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1563 |
20496
747a270eb1db
patch 8.2.0802: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20490
diff
changeset
|
1564 // Setting the scrolling region restores the cursor to the home position |
747a270eb1db
patch 8.2.0802: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20490
diff
changeset
|
1565 state->pos.row = 0; |
747a270eb1db
patch 8.2.0802: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20490
diff
changeset
|
1566 state->pos.col = 0; |
747a270eb1db
patch 8.2.0802: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20490
diff
changeset
|
1567 if(state->mode.origin) { |
747a270eb1db
patch 8.2.0802: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20490
diff
changeset
|
1568 state->pos.row += state->scrollregion_top; |
747a270eb1db
patch 8.2.0802: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20490
diff
changeset
|
1569 state->pos.col += SCROLLREGION_LEFT(state); |
747a270eb1db
patch 8.2.0802: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20490
diff
changeset
|
1570 } |
747a270eb1db
patch 8.2.0802: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20490
diff
changeset
|
1571 |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1572 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1573 |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
1574 case 0x73: // DECSLRM - DEC custom |
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
1575 // Always allow setting these margins, just they won't take effect without DECVSSM |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1576 state->scrollregion_left = CSI_ARG_OR(args[0], 1) - 1; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1577 state->scrollregion_right = argcount < 2 || CSI_ARG_IS_MISSING(args[1]) ? -1 : CSI_ARG(args[1]); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1578 LBOUND(state->scrollregion_left, 0); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1579 UBOUND(state->scrollregion_left, state->cols); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1580 LBOUND(state->scrollregion_right, -1); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1581 if(state->scrollregion_left == 0 && state->scrollregion_right == state->cols) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1582 state->scrollregion_right = -1; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1583 else |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1584 UBOUND(state->scrollregion_right, state->cols); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1585 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1586 if(state->scrollregion_right > -1 && |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1587 state->scrollregion_right <= state->scrollregion_left) { |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
1588 // Invalid |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1589 state->scrollregion_left = 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1590 state->scrollregion_right = -1; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1591 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1592 |
20496
747a270eb1db
patch 8.2.0802: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20490
diff
changeset
|
1593 // Setting the scrolling region restores the cursor to the home position |
747a270eb1db
patch 8.2.0802: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20490
diff
changeset
|
1594 state->pos.row = 0; |
747a270eb1db
patch 8.2.0802: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20490
diff
changeset
|
1595 state->pos.col = 0; |
747a270eb1db
patch 8.2.0802: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20490
diff
changeset
|
1596 if(state->mode.origin) { |
747a270eb1db
patch 8.2.0802: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20490
diff
changeset
|
1597 state->pos.row += state->scrollregion_top; |
747a270eb1db
patch 8.2.0802: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20490
diff
changeset
|
1598 state->pos.col += SCROLLREGION_LEFT(state); |
747a270eb1db
patch 8.2.0802: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20490
diff
changeset
|
1599 } |
747a270eb1db
patch 8.2.0802: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20490
diff
changeset
|
1600 |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1601 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1602 |
11715
d7430b56c9ed
patch 8.0.0740: cannot resize a terminal window by the command
Christian Brabandt <cb@256bit.org>
parents:
11621
diff
changeset
|
1603 case 0x74: |
d7430b56c9ed
patch 8.0.0740: cannot resize a terminal window by the command
Christian Brabandt <cb@256bit.org>
parents:
11621
diff
changeset
|
1604 switch(CSI_ARG(args[0])) { |
17777
811a12a78164
patch 8.1.1885: comments in libvterm are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
16435
diff
changeset
|
1605 case 8: // CSI 8 ; rows ; cols t set size |
11715
d7430b56c9ed
patch 8.0.0740: cannot resize a terminal window by the command
Christian Brabandt <cb@256bit.org>
parents:
11621
diff
changeset
|
1606 if (argcount == 3) |
d7430b56c9ed
patch 8.0.0740: cannot resize a terminal window by the command
Christian Brabandt <cb@256bit.org>
parents:
11621
diff
changeset
|
1607 on_resize(CSI_ARG(args[1]), CSI_ARG(args[2]), state); |
16241
c1698187c482
patch 8.1.1125: libvterm does not handle the window position report
Bram Moolenaar <Bram@vim.org>
parents:
15249
diff
changeset
|
1608 break; |
c1698187c482
patch 8.1.1125: libvterm does not handle the window position report
Bram Moolenaar <Bram@vim.org>
parents:
15249
diff
changeset
|
1609 default: |
c1698187c482
patch 8.1.1125: libvterm does not handle the window position report
Bram Moolenaar <Bram@vim.org>
parents:
15249
diff
changeset
|
1610 handled = 0; |
c1698187c482
patch 8.1.1125: libvterm does not handle the window position report
Bram Moolenaar <Bram@vim.org>
parents:
15249
diff
changeset
|
1611 break; |
11715
d7430b56c9ed
patch 8.0.0740: cannot resize a terminal window by the command
Christian Brabandt <cb@256bit.org>
parents:
11621
diff
changeset
|
1612 } |
d7430b56c9ed
patch 8.0.0740: cannot resize a terminal window by the command
Christian Brabandt <cb@256bit.org>
parents:
11621
diff
changeset
|
1613 break; |
d7430b56c9ed
patch 8.0.0740: cannot resize a terminal window by the command
Christian Brabandt <cb@256bit.org>
parents:
11621
diff
changeset
|
1614 |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
1615 case INTERMED('\'', 0x7D): // DECIC |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1616 count = CSI_ARG_COUNT(args[0]); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1617 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1618 if(!is_cursor_in_scrollregion(state)) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1619 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1620 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1621 rect.start_row = state->scrollregion_top; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1622 rect.end_row = SCROLLREGION_BOTTOM(state); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1623 rect.start_col = state->pos.col; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1624 rect.end_col = SCROLLREGION_RIGHT(state); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1625 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1626 scroll(state, rect, 0, -count); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1627 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1628 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1629 |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
1630 case INTERMED('\'', 0x7E): // DECDC |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1631 count = CSI_ARG_COUNT(args[0]); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1632 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1633 if(!is_cursor_in_scrollregion(state)) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1634 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1635 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1636 rect.start_row = state->scrollregion_top; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1637 rect.end_row = SCROLLREGION_BOTTOM(state); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1638 rect.start_col = state->pos.col; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1639 rect.end_col = SCROLLREGION_RIGHT(state); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1640 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1641 scroll(state, rect, 0, count); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1642 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1643 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1644 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1645 default: |
16241
c1698187c482
patch 8.1.1125: libvterm does not handle the window position report
Bram Moolenaar <Bram@vim.org>
parents:
15249
diff
changeset
|
1646 handled = 0; |
c1698187c482
patch 8.1.1125: libvterm does not handle the window position report
Bram Moolenaar <Bram@vim.org>
parents:
15249
diff
changeset
|
1647 break; |
c1698187c482
patch 8.1.1125: libvterm does not handle the window position report
Bram Moolenaar <Bram@vim.org>
parents:
15249
diff
changeset
|
1648 } |
c1698187c482
patch 8.1.1125: libvterm does not handle the window position report
Bram Moolenaar <Bram@vim.org>
parents:
15249
diff
changeset
|
1649 |
c1698187c482
patch 8.1.1125: libvterm does not handle the window position report
Bram Moolenaar <Bram@vim.org>
parents:
15249
diff
changeset
|
1650 if (!handled) { |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1651 if(state->fallbacks && state->fallbacks->csi) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1652 if((*state->fallbacks->csi)(leader, args, argcount, intermed, command, state->fbdata)) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1653 return 1; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1654 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1655 return 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1656 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1657 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1658 if(state->mode.origin) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1659 LBOUND(state->pos.row, state->scrollregion_top); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1660 UBOUND(state->pos.row, SCROLLREGION_BOTTOM(state)-1); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1661 LBOUND(state->pos.col, SCROLLREGION_LEFT(state)); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1662 UBOUND(state->pos.col, SCROLLREGION_RIGHT(state)-1); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1663 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1664 else { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1665 LBOUND(state->pos.row, 0); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1666 UBOUND(state->pos.row, state->rows-1); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1667 LBOUND(state->pos.col, 0); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1668 UBOUND(state->pos.col, THISROWWIDTH(state)-1); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1669 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1670 |
20448
89fade12827d
patch 8.2.0778: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
18279
diff
changeset
|
1671 updatecursor(state, &oldpos, cancel_phantom); |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1672 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1673 #ifdef DEBUG |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1674 if(state->pos.row < 0 || state->pos.row >= state->rows || |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1675 state->pos.col < 0 || state->pos.col >= state->cols) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1676 fprintf(stderr, "Position out of bounds after CSI %c: (%d,%d)\n", |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1677 command, state->pos.row, state->pos.col); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1678 abort(); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1679 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1680 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1681 if(SCROLLREGION_BOTTOM(state) <= state->scrollregion_top) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1682 fprintf(stderr, "Scroll region height out of bounds after CSI %c: %d <= %d\n", |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1683 command, SCROLLREGION_BOTTOM(state), state->scrollregion_top); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1684 abort(); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1685 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1686 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1687 if(SCROLLREGION_RIGHT(state) <= SCROLLREGION_LEFT(state)) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1688 fprintf(stderr, "Scroll region width out of bounds after CSI %c: %d <= %d\n", |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1689 command, SCROLLREGION_RIGHT(state), SCROLLREGION_LEFT(state)); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1690 abort(); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1691 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1692 #endif |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1693 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1694 return 1; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1695 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1696 |
26270
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1697 static char base64_one(uint8_t b) |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1698 { |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1699 if(b < 26) |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1700 return 'A' + b; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1701 else if(b < 52) |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1702 return 'a' + b - 26; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1703 else if(b < 62) |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1704 return '0' + b - 52; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1705 else if(b == 62) |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1706 return '+'; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1707 else if(b == 63) |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1708 return '/'; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1709 return 0; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1710 } |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1711 |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1712 static uint8_t unbase64one(char c) |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1713 { |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1714 if(c >= 'A' && c <= 'Z') |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1715 return c - 'A'; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1716 else if(c >= 'a' && c <= 'z') |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1717 return c - 'a' + 26; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1718 else if(c >= '0' && c <= '9') |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1719 return c - '0' + 52; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1720 else if(c == '+') |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1721 return 62; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1722 else if(c == '/') |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1723 return 63; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1724 |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1725 return 0xFF; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1726 } |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1727 |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1728 static void osc_selection(VTermState *state, VTermStringFragment frag) |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1729 { |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1730 if(frag.initial) { |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1731 state->tmp.selection.mask = 0; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1732 state->tmp.selection.state = SELECTION_INITIAL; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1733 } |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1734 |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1735 while(!state->tmp.selection.state && frag.len) { |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1736 /* Parse selection parameter */ |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1737 switch(frag.str[0]) { |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1738 case 'c': |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1739 state->tmp.selection.mask |= VTERM_SELECTION_CLIPBOARD; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1740 break; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1741 case 'p': |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1742 state->tmp.selection.mask |= VTERM_SELECTION_PRIMARY; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1743 break; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1744 case 'q': |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1745 state->tmp.selection.mask |= VTERM_SELECTION_SECONDARY; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1746 break; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1747 case 's': |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1748 state->tmp.selection.mask |= VTERM_SELECTION_SELECT; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1749 break; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1750 case '0': |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1751 case '1': |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1752 case '2': |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1753 case '3': |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1754 case '4': |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1755 case '5': |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1756 case '6': |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1757 case '7': |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1758 state->tmp.selection.mask |= (VTERM_SELECTION_CUT0 << (frag.str[0] - '0')); |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1759 break; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1760 |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1761 case ';': |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1762 state->tmp.selection.state = SELECTION_SELECTED; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1763 if(!state->tmp.selection.mask) |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1764 state->tmp.selection.mask = VTERM_SELECTION_SELECT|VTERM_SELECTION_CUT0; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1765 break; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1766 } |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1767 |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1768 frag.str++; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1769 frag.len--; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1770 } |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1771 |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1772 if(!frag.len) |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1773 return; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1774 |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1775 if(state->tmp.selection.state == SELECTION_SELECTED) { |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1776 if(frag.str[0] == '?') { |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1777 state->tmp.selection.state = SELECTION_QUERY; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1778 } |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1779 else { |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1780 state->tmp.selection.state = SELECTION_SET_INITIAL; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1781 state->tmp.selection.recvpartial = 0; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1782 } |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1783 } |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1784 |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1785 if(state->tmp.selection.state == SELECTION_QUERY) { |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1786 if(state->selection.callbacks->query) |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1787 (*state->selection.callbacks->query)(state->tmp.selection.mask, state->selection.user); |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1788 return; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1789 } |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1790 |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1791 if(state->selection.callbacks->set) { |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1792 size_t bufcur = 0; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1793 char *buffer = state->selection.buffer; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1794 |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1795 uint32_t x = 0; /* Current decoding value */ |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1796 int n = 0; /* Number of sextets consumed */ |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1797 |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1798 if(state->tmp.selection.recvpartial) { |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1799 n = state->tmp.selection.recvpartial >> 24; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1800 x = state->tmp.selection.recvpartial & 0x03FFFF; /* could be up to 18 bits of state in here */ |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1801 |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1802 state->tmp.selection.recvpartial = 0; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1803 } |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1804 |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1805 while((state->selection.buflen - bufcur) >= 3 && frag.len) { |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1806 if(frag.str[0] == '=') { |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1807 if(n == 2) { |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1808 buffer[0] = (x >> 4) & 0xFF; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1809 buffer += 1, bufcur += 1; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1810 } |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1811 if(n == 3) { |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1812 buffer[0] = (x >> 10) & 0xFF; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1813 buffer[1] = (x >> 2) & 0xFF; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1814 buffer += 2, bufcur += 2; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1815 } |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1816 |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1817 while(frag.len && frag.str[0] == '=') |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1818 frag.str++, frag.len--; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1819 |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1820 n = 0; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1821 } |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1822 else { |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1823 uint8_t b = unbase64one(frag.str[0]); |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1824 if(b == 0xFF) { |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1825 DEBUG_LOG1("base64decode bad input %02X\n", (uint8_t)frag.str[0]); |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1826 } |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1827 else { |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1828 x = (x << 6) | b; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1829 n++; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1830 } |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1831 frag.str++, frag.len--; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1832 |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1833 if(n == 4) { |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1834 buffer[0] = (x >> 16) & 0xFF; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1835 buffer[1] = (x >> 8) & 0xFF; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1836 buffer[2] = (x >> 0) & 0xFF; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1837 |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1838 buffer += 3, bufcur += 3; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1839 x = 0; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1840 n = 0; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1841 } |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1842 } |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1843 |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1844 if(!frag.len || (state->selection.buflen - bufcur) < 3) { |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1845 if(bufcur) { |
26272
58a7c651c313
patch 8.2.3667: building libvterm fails with MSVC
Bram Moolenaar <Bram@vim.org>
parents:
26270
diff
changeset
|
1846 VTermStringFragment setfrag = { |
58a7c651c313
patch 8.2.3667: building libvterm fails with MSVC
Bram Moolenaar <Bram@vim.org>
parents:
26270
diff
changeset
|
1847 state->selection.buffer, // str |
58a7c651c313
patch 8.2.3667: building libvterm fails with MSVC
Bram Moolenaar <Bram@vim.org>
parents:
26270
diff
changeset
|
1848 bufcur, // len |
58a7c651c313
patch 8.2.3667: building libvterm fails with MSVC
Bram Moolenaar <Bram@vim.org>
parents:
26270
diff
changeset
|
1849 state->tmp.selection.state == SELECTION_SET_INITIAL, // initial |
58a7c651c313
patch 8.2.3667: building libvterm fails with MSVC
Bram Moolenaar <Bram@vim.org>
parents:
26270
diff
changeset
|
1850 frag.final // final |
58a7c651c313
patch 8.2.3667: building libvterm fails with MSVC
Bram Moolenaar <Bram@vim.org>
parents:
26270
diff
changeset
|
1851 }; |
58a7c651c313
patch 8.2.3667: building libvterm fails with MSVC
Bram Moolenaar <Bram@vim.org>
parents:
26270
diff
changeset
|
1852 (*state->selection.callbacks->set)(state->tmp.selection.mask, |
58a7c651c313
patch 8.2.3667: building libvterm fails with MSVC
Bram Moolenaar <Bram@vim.org>
parents:
26270
diff
changeset
|
1853 setfrag, state->selection.user); |
26270
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1854 state->tmp.selection.state = SELECTION_SET; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1855 } |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1856 |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1857 buffer = state->selection.buffer; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1858 bufcur = 0; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1859 } |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1860 } |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1861 |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1862 if(n) |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1863 state->tmp.selection.recvpartial = (n << 24) | x; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1864 } |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1865 } |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1866 |
20488
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
1867 static int on_osc(int command, VTermStringFragment frag, void *user) |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1868 { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1869 VTermState *state = user; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1870 |
20488
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
1871 switch(command) { |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
1872 case 0: |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
1873 settermprop_string(state, VTERM_PROP_ICONNAME, frag); |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
1874 settermprop_string(state, VTERM_PROP_TITLE, frag); |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
1875 return 1; |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
1876 |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
1877 case 1: |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
1878 settermprop_string(state, VTERM_PROP_ICONNAME, frag); |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
1879 return 1; |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
1880 |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
1881 case 2: |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
1882 settermprop_string(state, VTERM_PROP_TITLE, frag); |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
1883 return 1; |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1884 |
20488
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
1885 case 10: |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
1886 { |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
1887 // request foreground color: <Esc>]10;?<0x07> |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
1888 int red = state->default_fg.red; |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
1889 int blue = state->default_fg.blue; |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
1890 int green = state->default_fg.green; |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
1891 vterm_push_output_sprintf_ctrl(state->vt, C1_OSC, "10;rgb:%02x%02x/%02x%02x/%02x%02x\x07", red, red, green, green, blue, blue); |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
1892 return 1; |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
1893 } |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
1894 |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
1895 case 11: |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
1896 { |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
1897 // request background color: <Esc>]11;?<0x07> |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
1898 int red = state->default_bg.red; |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
1899 int blue = state->default_bg.blue; |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
1900 int green = state->default_bg.green; |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
1901 vterm_push_output_sprintf_ctrl(state->vt, C1_OSC, "11;rgb:%02x%02x/%02x%02x/%02x%02x\x07", red, red, green, green, blue, blue); |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
1902 return 1; |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
1903 } |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
1904 case 12: |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
1905 settermprop_string(state, VTERM_PROP_CURSORCOLOR, frag); |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
1906 return 1; |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
1907 |
26270
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1908 case 52: |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1909 if(state->selection.callbacks) |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1910 osc_selection(state, frag); |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1911 |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1912 return 1; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1913 |
20488
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
1914 default: |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
1915 if(state->fallbacks && state->fallbacks->osc) |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
1916 if((*state->fallbacks->osc)(command, frag, state->fbdata)) |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
1917 return 1; |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1918 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1919 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1920 return 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1921 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1922 |
20488
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
1923 static void request_status_string(VTermState *state, VTermStringFragment frag) |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1924 { |
20460
c15dd3da4f47
patch 8.2.0784: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20448
diff
changeset
|
1925 VTerm *vt = state->vt; |
c15dd3da4f47
patch 8.2.0784: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20448
diff
changeset
|
1926 |
20488
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
1927 char *tmp = state->tmp.decrqss; |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
1928 |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
1929 if(frag.initial) |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
1930 tmp[0] = tmp[1] = tmp[2] = tmp[3] = 0; |
20460
c15dd3da4f47
patch 8.2.0784: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20448
diff
changeset
|
1931 |
30880
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
1932 size_t i = 0; |
20488
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
1933 while(i < sizeof(state->tmp.decrqss)-1 && tmp[i]) |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
1934 i++; |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
1935 while(i < sizeof(state->tmp.decrqss)-1 && frag.len--) |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
1936 tmp[i++] = (frag.str++)[0]; |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
1937 tmp[i] = 0; |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
1938 |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
1939 if(!frag.final) |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
1940 return; |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
1941 |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
1942 switch(tmp[0] | tmp[1]<<8 | tmp[2]<<16) { |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
1943 case 'm': { |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
1944 // Query SGR |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
1945 long args[20]; |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
1946 int argc = vterm_state_getpen(state, args, sizeof(args)/sizeof(args[0])); |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
1947 size_t cur = 0; |
20460
c15dd3da4f47
patch 8.2.0784: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20448
diff
changeset
|
1948 |
20490
1ee7baa5173b
patch 8.2.0799: build fails if snprintf is not available
Bram Moolenaar <Bram@vim.org>
parents:
20488
diff
changeset
|
1949 cur += SNPRINTF(vt->tmpbuffer + cur, vt->tmpbuffer_len - cur, |
20488
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
1950 vt->mode.ctrl8bit ? "\x90" "1$r" : ESC_S "P" "1$r"); // DCS 1$r ... |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
1951 if(cur >= vt->tmpbuffer_len) |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
1952 return; |
20460
c15dd3da4f47
patch 8.2.0784: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20448
diff
changeset
|
1953 |
30880
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
1954 for(int argi = 0; argi < argc; argi++) { |
20490
1ee7baa5173b
patch 8.2.0799: build fails if snprintf is not available
Bram Moolenaar <Bram@vim.org>
parents:
20488
diff
changeset
|
1955 cur += SNPRINTF(vt->tmpbuffer + cur, vt->tmpbuffer_len - cur, |
20488
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
1956 argi == argc - 1 ? "%ld" : |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
1957 CSI_ARG_HAS_MORE(args[argi]) ? "%ld:" : |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
1958 "%ld;", |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
1959 CSI_ARG(args[argi])); |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
1960 if(cur >= vt->tmpbuffer_len) |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
1961 return; |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
1962 } |
20460
c15dd3da4f47
patch 8.2.0784: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20448
diff
changeset
|
1963 |
20490
1ee7baa5173b
patch 8.2.0799: build fails if snprintf is not available
Bram Moolenaar <Bram@vim.org>
parents:
20488
diff
changeset
|
1964 cur += SNPRINTF(vt->tmpbuffer + cur, vt->tmpbuffer_len - cur, |
20488
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
1965 vt->mode.ctrl8bit ? "m" "\x9C" : "m" ESC_S "\\"); // ... m ST |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
1966 if(cur >= vt->tmpbuffer_len) |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1967 return; |
20488
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
1968 |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
1969 vterm_push_output_bytes(vt, vt->tmpbuffer, cur); |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
1970 return; |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1971 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1972 |
20488
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
1973 case 'r': |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
1974 // Query DECSTBM |
26270
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1975 vterm_push_output_sprintf_str(vt, C1_DCS, TRUE, |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1976 "1$r%d;%dr", state->scrollregion_top+1, SCROLLREGION_BOTTOM(state)); |
20488
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
1977 return; |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
1978 |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
1979 case 's': |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
1980 // Query DECSLRM |
26270
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1981 vterm_push_output_sprintf_str(vt, C1_DCS, TRUE, |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1982 "1$r%d;%ds", SCROLLREGION_LEFT(state)+1, SCROLLREGION_RIGHT(state)); |
20488
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
1983 return; |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
1984 |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
1985 case ' '|('q'<<8): { |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
1986 // Query DECSCUSR |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1987 int reply; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1988 switch(state->mode.cursor_shape) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1989 case VTERM_PROP_CURSORSHAPE_BLOCK: reply = 2; break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1990 case VTERM_PROP_CURSORSHAPE_UNDERLINE: reply = 4; break; |
17777
811a12a78164
patch 8.1.1885: comments in libvterm are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
16435
diff
changeset
|
1991 default: /* VTERM_PROP_CURSORSHAPE_BAR_LEFT */ reply = 6; break; |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1992 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1993 if(state->mode.cursor_blink) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1994 reply--; |
26270
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1995 vterm_push_output_sprintf_str(vt, C1_DCS, TRUE, |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
1996 "1$r%d q", reply); |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1997 return; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1998 } |
20488
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
1999 |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
2000 case '\"'|('q'<<8): |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
2001 // Query DECSCA |
26270
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2002 vterm_push_output_sprintf_str(vt, C1_DCS, TRUE, |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2003 "1$r%d\"q", state->protected_cell ? 1 : 2); |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2004 return; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2005 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2006 |
26270
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2007 vterm_push_output_sprintf_str(state->vt, C1_DCS, TRUE, "0$r%s", tmp); |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2008 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2009 |
20488
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
2010 static int on_dcs(const char *command, size_t commandlen, VTermStringFragment frag, void *user) |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2011 { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2012 VTermState *state = user; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2013 |
20488
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
2014 if(commandlen == 2 && strneq(command, "$q", 2)) { |
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
2015 request_status_string(state, frag); |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2016 return 1; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2017 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2018 else if(state->fallbacks && state->fallbacks->dcs) |
20488
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
2019 if((*state->fallbacks->dcs)(command, commandlen, frag, state->fbdata)) |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2020 return 1; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2021 |
20488
1d595fada804
patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20486
diff
changeset
|
2022 DEBUG_LOG2("libvterm: Unhandled DCS %.*s\n", (int)commandlen, command); |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2023 return 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2024 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2025 |
26270
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2026 static int on_apc(VTermStringFragment frag, void *user) |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2027 { |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2028 VTermState *state = user; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2029 |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2030 if(state->fallbacks && state->fallbacks->apc) |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2031 if((*state->fallbacks->apc)(frag, state->fbdata)) |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2032 return 1; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2033 |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2034 /* No DEBUG_LOG because all APCs are unhandled */ |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2035 return 0; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2036 } |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2037 |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2038 static int on_pm(VTermStringFragment frag, void *user) |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2039 { |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2040 VTermState *state = user; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2041 |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2042 if(state->fallbacks && state->fallbacks->pm) |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2043 if((*state->fallbacks->pm)(frag, state->fbdata)) |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2044 return 1; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2045 |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2046 /* No DEBUG_LOG because all PMs are unhandled */ |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2047 return 0; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2048 } |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2049 |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2050 static int on_sos(VTermStringFragment frag, void *user) |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2051 { |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2052 VTermState *state = user; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2053 |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2054 if(state->fallbacks && state->fallbacks->sos) |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2055 if((*state->fallbacks->sos)(frag, state->fbdata)) |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2056 return 1; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2057 |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2058 /* No DEBUG_LOG because all SOSs are unhandled */ |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2059 return 0; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2060 } |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2061 |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2062 static int on_resize(int rows, int cols, void *user) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2063 { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2064 VTermState *state = user; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2065 VTermPos oldpos = state->pos; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2066 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2067 if(cols != state->cols) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2068 unsigned char *newtabstops = vterm_allocator_malloc(state->vt, (cols + 7) / 8); |
16429
a1229400434a
patch 8.1.1219: not checking for NULL return from alloc()
Bram Moolenaar <Bram@vim.org>
parents:
16241
diff
changeset
|
2069 if (newtabstops == NULL) |
a1229400434a
patch 8.1.1219: not checking for NULL return from alloc()
Bram Moolenaar <Bram@vim.org>
parents:
16241
diff
changeset
|
2070 return 0; |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2071 |
20518
a4652d7ec99f
patch 8.2.0813: libvterm code is slightly different from upstream
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
2072 /* TODO: This can all be done much more efficiently bytewise */ |
30880
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
2073 int col; |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2074 for(col = 0; col < state->cols && col < cols; col++) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2075 unsigned char mask = 1 << (col & 7); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2076 if(state->tabstops[col >> 3] & mask) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2077 newtabstops[col >> 3] |= mask; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2078 else |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2079 newtabstops[col >> 3] &= ~mask; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2080 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2081 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2082 for( ; col < cols; col++) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2083 unsigned char mask = 1 << (col & 7); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2084 if(col % 8 == 0) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2085 newtabstops[col >> 3] |= mask; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2086 else |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2087 newtabstops[col >> 3] &= ~mask; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2088 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2089 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2090 vterm_allocator_free(state->vt, state->tabstops); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2091 state->tabstops = newtabstops; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2092 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2093 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2094 state->rows = rows; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2095 state->cols = cols; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2096 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2097 if(state->scrollregion_bottom > -1) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2098 UBOUND(state->scrollregion_bottom, state->rows); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2099 if(state->scrollregion_right > -1) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2100 UBOUND(state->scrollregion_right, state->cols); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2101 |
30880
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
2102 VTermStateFields fields; |
20480
d0bf39eb2b07
patch 8.2.0794: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20460
diff
changeset
|
2103 fields.pos = state->pos; |
30876
2d2758ffd959
patch 9.0.0772: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26272
diff
changeset
|
2104 fields.lineinfos[0] = state->lineinfos[0]; |
2d2758ffd959
patch 9.0.0772: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26272
diff
changeset
|
2105 fields.lineinfos[1] = state->lineinfos[1]; |
2d2758ffd959
patch 9.0.0772: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26272
diff
changeset
|
2106 |
2d2758ffd959
patch 9.0.0772: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26272
diff
changeset
|
2107 if(state->callbacks && state->callbacks->resize) { |
20480
d0bf39eb2b07
patch 8.2.0794: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20460
diff
changeset
|
2108 (*state->callbacks->resize)(rows, cols, &fields, state->cbdata); |
30876
2d2758ffd959
patch 9.0.0772: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26272
diff
changeset
|
2109 state->pos = fields.pos; |
2d2758ffd959
patch 9.0.0772: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26272
diff
changeset
|
2110 |
2d2758ffd959
patch 9.0.0772: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26272
diff
changeset
|
2111 state->lineinfos[0] = fields.lineinfos[0]; |
2d2758ffd959
patch 9.0.0772: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26272
diff
changeset
|
2112 state->lineinfos[1] = fields.lineinfos[1]; |
2d2758ffd959
patch 9.0.0772: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26272
diff
changeset
|
2113 } |
2d2758ffd959
patch 9.0.0772: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26272
diff
changeset
|
2114 else { |
2d2758ffd959
patch 9.0.0772: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26272
diff
changeset
|
2115 if(rows != state->rows) { |
2d2758ffd959
patch 9.0.0772: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26272
diff
changeset
|
2116 for(int bufidx = BUFIDX_PRIMARY; bufidx <= BUFIDX_ALTSCREEN; bufidx++) { |
2d2758ffd959
patch 9.0.0772: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26272
diff
changeset
|
2117 VTermLineInfo *oldlineinfo = state->lineinfos[bufidx]; |
2d2758ffd959
patch 9.0.0772: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26272
diff
changeset
|
2118 if(!oldlineinfo) |
2d2758ffd959
patch 9.0.0772: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26272
diff
changeset
|
2119 continue; |
2d2758ffd959
patch 9.0.0772: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26272
diff
changeset
|
2120 |
2d2758ffd959
patch 9.0.0772: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26272
diff
changeset
|
2121 VTermLineInfo *newlineinfo = vterm_allocator_malloc(state->vt, rows * sizeof(VTermLineInfo)); |
2d2758ffd959
patch 9.0.0772: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26272
diff
changeset
|
2122 |
2d2758ffd959
patch 9.0.0772: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26272
diff
changeset
|
2123 int row; |
2d2758ffd959
patch 9.0.0772: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26272
diff
changeset
|
2124 for(row = 0; row < state->rows && row < rows; row++) { |
2d2758ffd959
patch 9.0.0772: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26272
diff
changeset
|
2125 newlineinfo[row] = oldlineinfo[row]; |
2d2758ffd959
patch 9.0.0772: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26272
diff
changeset
|
2126 } |
2d2758ffd959
patch 9.0.0772: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26272
diff
changeset
|
2127 |
2d2758ffd959
patch 9.0.0772: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26272
diff
changeset
|
2128 for( ; row < rows; row++) { |
2d2758ffd959
patch 9.0.0772: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26272
diff
changeset
|
2129 newlineinfo[row] = (VTermLineInfo){ |
2d2758ffd959
patch 9.0.0772: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26272
diff
changeset
|
2130 .doublewidth = 0, |
2d2758ffd959
patch 9.0.0772: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26272
diff
changeset
|
2131 }; |
2d2758ffd959
patch 9.0.0772: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26272
diff
changeset
|
2132 } |
2d2758ffd959
patch 9.0.0772: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26272
diff
changeset
|
2133 |
2d2758ffd959
patch 9.0.0772: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26272
diff
changeset
|
2134 vterm_allocator_free(state->vt, state->lineinfos[bufidx]); |
2d2758ffd959
patch 9.0.0772: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26272
diff
changeset
|
2135 state->lineinfos[bufidx] = newlineinfo; |
2d2758ffd959
patch 9.0.0772: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26272
diff
changeset
|
2136 } |
2d2758ffd959
patch 9.0.0772: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26272
diff
changeset
|
2137 } |
2d2758ffd959
patch 9.0.0772: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26272
diff
changeset
|
2138 } |
2d2758ffd959
patch 9.0.0772: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26272
diff
changeset
|
2139 |
2d2758ffd959
patch 9.0.0772: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26272
diff
changeset
|
2140 state->lineinfo = state->lineinfos[state->mode.alt_screen ? BUFIDX_ALTSCREEN : BUFIDX_PRIMARY]; |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2141 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2142 if(state->at_phantom && state->pos.col < cols-1) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2143 state->at_phantom = 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2144 state->pos.col++; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2145 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2146 |
20957
2f2bc98a8dfb
patch 8.2.1030: reducing size of a terminal window may cause a crash
Bram Moolenaar <Bram@vim.org>
parents:
20917
diff
changeset
|
2147 if(state->pos.row < 0) |
2f2bc98a8dfb
patch 8.2.1030: reducing size of a terminal window may cause a crash
Bram Moolenaar <Bram@vim.org>
parents:
20917
diff
changeset
|
2148 state->pos.row = 0; |
21042
f5206c704403
patch 8.2.1072: missing libvterm test
Bram Moolenaar <Bram@vim.org>
parents:
20957
diff
changeset
|
2149 if(state->pos.row >= rows) |
f5206c704403
patch 8.2.1072: missing libvterm test
Bram Moolenaar <Bram@vim.org>
parents:
20957
diff
changeset
|
2150 state->pos.row = rows - 1; |
f5206c704403
patch 8.2.1072: missing libvterm test
Bram Moolenaar <Bram@vim.org>
parents:
20957
diff
changeset
|
2151 if(state->pos.col < 0) |
f5206c704403
patch 8.2.1072: missing libvterm test
Bram Moolenaar <Bram@vim.org>
parents:
20957
diff
changeset
|
2152 state->pos.col = 0; |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2153 if(state->pos.col >= cols) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2154 state->pos.col = cols - 1; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2155 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2156 updatecursor(state, &oldpos, 1); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2157 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2158 return 1; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2159 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2160 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2161 static const VTermParserCallbacks parser_callbacks = { |
17777
811a12a78164
patch 8.1.1885: comments in libvterm are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
16435
diff
changeset
|
2162 on_text, // text |
811a12a78164
patch 8.1.1885: comments in libvterm are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
16435
diff
changeset
|
2163 on_control, // control |
811a12a78164
patch 8.1.1885: comments in libvterm are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
16435
diff
changeset
|
2164 on_escape, // escape |
811a12a78164
patch 8.1.1885: comments in libvterm are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
16435
diff
changeset
|
2165 on_csi, // csi |
811a12a78164
patch 8.1.1885: comments in libvterm are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
16435
diff
changeset
|
2166 on_osc, // osc |
811a12a78164
patch 8.1.1885: comments in libvterm are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
16435
diff
changeset
|
2167 on_dcs, // dcs |
26270
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2168 on_apc, // apc |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2169 on_pm, // pm |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2170 on_sos, // sos |
17777
811a12a78164
patch 8.1.1885: comments in libvterm are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
16435
diff
changeset
|
2171 on_resize // resize |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2172 }; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2173 |
15249
544490b69e1d
patch 8.1.0633: crash when out of memory while opening a terminal window
Bram Moolenaar <Bram@vim.org>
parents:
14315
diff
changeset
|
2174 /* |
544490b69e1d
patch 8.1.0633: crash when out of memory while opening a terminal window
Bram Moolenaar <Bram@vim.org>
parents:
14315
diff
changeset
|
2175 * Return the existing state or create a new one. |
544490b69e1d
patch 8.1.0633: crash when out of memory while opening a terminal window
Bram Moolenaar <Bram@vim.org>
parents:
14315
diff
changeset
|
2176 * Returns NULL when out of memory. |
544490b69e1d
patch 8.1.0633: crash when out of memory while opening a terminal window
Bram Moolenaar <Bram@vim.org>
parents:
14315
diff
changeset
|
2177 */ |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2178 VTermState *vterm_obtain_state(VTerm *vt) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2179 { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2180 if(vt->state) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2181 return vt->state; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2182 |
30880
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
2183 VTermState *state = vterm_state_new(vt); |
15249
544490b69e1d
patch 8.1.0633: crash when out of memory while opening a terminal window
Bram Moolenaar <Bram@vim.org>
parents:
14315
diff
changeset
|
2184 if (state == NULL) |
544490b69e1d
patch 8.1.0633: crash when out of memory while opening a terminal window
Bram Moolenaar <Bram@vim.org>
parents:
14315
diff
changeset
|
2185 return NULL; |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2186 vt->state = state; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2187 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2188 vterm_parser_set_callbacks(vt, &parser_callbacks, state); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2189 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2190 return state; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2191 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2192 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2193 void vterm_state_reset(VTermState *state, int hard) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2194 { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2195 state->scrollregion_top = 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2196 state->scrollregion_bottom = -1; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2197 state->scrollregion_left = 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2198 state->scrollregion_right = -1; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2199 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2200 state->mode.keypad = 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2201 state->mode.cursor = 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2202 state->mode.autowrap = 1; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2203 state->mode.insert = 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2204 state->mode.newline = 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2205 state->mode.alt_screen = 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2206 state->mode.origin = 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2207 state->mode.leftrightmargin = 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2208 state->mode.bracketpaste = 0; |
13531
9f857e6310b6
patch 8.0.1639: libvterm code lags behind master
Christian Brabandt <cb@256bit.org>
parents:
13448
diff
changeset
|
2209 state->mode.report_focus = 0; |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2210 |
26270
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2211 state->mouse_flags = 0; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2212 |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2213 state->vt->mode.ctrl8bit = 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2214 |
30880
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
2215 for(int col = 0; col < state->cols; col++) |
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
2216 if(col % 8 == 0) |
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
2217 set_col_tabstop(state, col); |
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
2218 else |
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
2219 clear_col_tabstop(state, col); |
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
2220 |
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
2221 for(int row = 0; row < state->rows; row++) |
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
2222 set_lineinfo(state, row, FORCE, DWL_OFF, DHL_OFF); |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2223 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2224 if(state->callbacks && state->callbacks->initpen) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2225 (*state->callbacks->initpen)(state->cbdata); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2226 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2227 vterm_state_resetpen(state); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2228 |
30880
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
2229 VTermEncoding *default_enc = state->vt->mode.utf8 ? |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2230 vterm_lookup_encoding(ENC_UTF8, 'u') : |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2231 vterm_lookup_encoding(ENC_SINGLE_94, 'B'); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2232 |
30880
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
2233 for(int i = 0; i < 4; i++) { |
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
2234 state->encoding[i].enc = default_enc; |
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
2235 if(default_enc->init) |
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
2236 (*default_enc->init)(default_enc, state->encoding[i].data); |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2237 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2238 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2239 state->gl_set = 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2240 state->gr_set = 1; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2241 state->gsingle_set = 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2242 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2243 state->protected_cell = 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2244 |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
2245 // Initialise the props |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2246 settermprop_bool(state, VTERM_PROP_CURSORVISIBLE, 1); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2247 settermprop_bool(state, VTERM_PROP_CURSORBLINK, 1); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2248 settermprop_int (state, VTERM_PROP_CURSORSHAPE, VTERM_PROP_CURSORSHAPE_BLOCK); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2249 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2250 if(hard) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2251 state->pos.row = 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2252 state->pos.col = 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2253 state->at_phantom = 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2254 |
30880
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
30876
diff
changeset
|
2255 VTermRect rect = { 0, 0, 0, 0 }; |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2256 rect.end_row = state->rows; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2257 rect.end_col = state->cols; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2258 erase(state, rect, 0); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2259 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2260 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2261 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2262 void vterm_state_get_cursorpos(const VTermState *state, VTermPos *cursorpos) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2263 { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2264 *cursorpos = state->pos; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2265 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2266 |
13448
a62b0bbc8834
patch 8.0.1598: cannot select text in a terminal with the mouse
Christian Brabandt <cb@256bit.org>
parents:
13318
diff
changeset
|
2267 void vterm_state_get_mousestate(const VTermState *state, VTermMouseState *mousestate) |
a62b0bbc8834
patch 8.0.1598: cannot select text in a terminal with the mouse
Christian Brabandt <cb@256bit.org>
parents:
13318
diff
changeset
|
2268 { |
a62b0bbc8834
patch 8.0.1598: cannot select text in a terminal with the mouse
Christian Brabandt <cb@256bit.org>
parents:
13318
diff
changeset
|
2269 mousestate->pos.col = state->mouse_col; |
a62b0bbc8834
patch 8.0.1598: cannot select text in a terminal with the mouse
Christian Brabandt <cb@256bit.org>
parents:
13318
diff
changeset
|
2270 mousestate->pos.row = state->mouse_row; |
a62b0bbc8834
patch 8.0.1598: cannot select text in a terminal with the mouse
Christian Brabandt <cb@256bit.org>
parents:
13318
diff
changeset
|
2271 mousestate->buttons = state->mouse_buttons; |
a62b0bbc8834
patch 8.0.1598: cannot select text in a terminal with the mouse
Christian Brabandt <cb@256bit.org>
parents:
13318
diff
changeset
|
2272 mousestate->flags = state->mouse_flags; |
a62b0bbc8834
patch 8.0.1598: cannot select text in a terminal with the mouse
Christian Brabandt <cb@256bit.org>
parents:
13318
diff
changeset
|
2273 } |
a62b0bbc8834
patch 8.0.1598: cannot select text in a terminal with the mouse
Christian Brabandt <cb@256bit.org>
parents:
13318
diff
changeset
|
2274 |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2275 void vterm_state_set_callbacks(VTermState *state, const VTermStateCallbacks *callbacks, void *user) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2276 { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2277 if(callbacks) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2278 state->callbacks = callbacks; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2279 state->cbdata = user; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2280 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2281 if(state->callbacks && state->callbacks->initpen) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2282 (*state->callbacks->initpen)(state->cbdata); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2283 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2284 else { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2285 state->callbacks = NULL; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2286 state->cbdata = NULL; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2287 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2288 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2289 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2290 void *vterm_state_get_cbdata(VTermState *state) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2291 { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2292 return state->cbdata; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2293 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2294 |
20496
747a270eb1db
patch 8.2.0802: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20490
diff
changeset
|
2295 void vterm_state_set_unrecognised_fallbacks(VTermState *state, const VTermStateFallbacks *fallbacks, void *user) |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2296 { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2297 if(fallbacks) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2298 state->fallbacks = fallbacks; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2299 state->fbdata = user; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2300 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2301 else { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2302 state->fallbacks = NULL; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2303 state->fbdata = NULL; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2304 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2305 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2306 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2307 void *vterm_state_get_unrecognised_fbdata(VTermState *state) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2308 { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2309 return state->fbdata; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2310 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2311 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2312 int vterm_state_set_termprop(VTermState *state, VTermProp prop, VTermValue *val) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2313 { |
20518
a4652d7ec99f
patch 8.2.0813: libvterm code is slightly different from upstream
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
2314 /* Only store the new value of the property if usercode said it was happy. |
a4652d7ec99f
patch 8.2.0813: libvterm code is slightly different from upstream
Bram Moolenaar <Bram@vim.org>
parents:
20500
diff
changeset
|
2315 * This is especially important for altscreen switching */ |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2316 if(state->callbacks && state->callbacks->settermprop) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2317 if(!(*state->callbacks->settermprop)(prop, val, state->cbdata)) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2318 return 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2319 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2320 switch(prop) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2321 case VTERM_PROP_TITLE: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2322 case VTERM_PROP_ICONNAME: |
12076
ca4931a20f8c
patch 8.0.0918: cannot get terminal window cursor shape or attributes
Christian Brabandt <cb@256bit.org>
parents:
11790
diff
changeset
|
2323 case VTERM_PROP_CURSORCOLOR: |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
13531
diff
changeset
|
2324 // we don't store these, just transparently pass through |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2325 return 1; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2326 case VTERM_PROP_CURSORVISIBLE: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2327 state->mode.cursor_visible = val->boolean; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2328 return 1; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2329 case VTERM_PROP_CURSORBLINK: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2330 state->mode.cursor_blink = val->boolean; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2331 return 1; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2332 case VTERM_PROP_CURSORSHAPE: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2333 state->mode.cursor_shape = val->number; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2334 return 1; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2335 case VTERM_PROP_REVERSE: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2336 state->mode.screen = val->boolean; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2337 return 1; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2338 case VTERM_PROP_ALTSCREEN: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2339 state->mode.alt_screen = val->boolean; |
20480
d0bf39eb2b07
patch 8.2.0794: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
20460
diff
changeset
|
2340 state->lineinfo = state->lineinfos[state->mode.alt_screen ? BUFIDX_ALTSCREEN : BUFIDX_PRIMARY]; |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2341 if(state->mode.alt_screen) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2342 VTermRect rect = {0, 0, 0, 0}; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2343 rect.end_row = state->rows; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2344 rect.end_col = state->cols; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2345 erase(state, rect, 0); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2346 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2347 return 1; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2348 case VTERM_PROP_MOUSE: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2349 state->mouse_flags = 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2350 if(val->number) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2351 state->mouse_flags |= MOUSE_WANT_CLICK; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2352 if(val->number == VTERM_PROP_MOUSE_DRAG) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2353 state->mouse_flags |= MOUSE_WANT_DRAG; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2354 if(val->number == VTERM_PROP_MOUSE_MOVE) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2355 state->mouse_flags |= MOUSE_WANT_MOVE; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2356 return 1; |
13531
9f857e6310b6
patch 8.0.1639: libvterm code lags behind master
Christian Brabandt <cb@256bit.org>
parents:
13448
diff
changeset
|
2357 |
9f857e6310b6
patch 8.0.1639: libvterm code lags behind master
Christian Brabandt <cb@256bit.org>
parents:
13448
diff
changeset
|
2358 case VTERM_N_PROPS: |
9f857e6310b6
patch 8.0.1639: libvterm code lags behind master
Christian Brabandt <cb@256bit.org>
parents:
13448
diff
changeset
|
2359 return 0; |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2360 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2361 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2362 return 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2363 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2364 |
13531
9f857e6310b6
patch 8.0.1639: libvterm code lags behind master
Christian Brabandt <cb@256bit.org>
parents:
13448
diff
changeset
|
2365 void vterm_state_focus_in(VTermState *state) |
9f857e6310b6
patch 8.0.1639: libvterm code lags behind master
Christian Brabandt <cb@256bit.org>
parents:
13448
diff
changeset
|
2366 { |
9f857e6310b6
patch 8.0.1639: libvterm code lags behind master
Christian Brabandt <cb@256bit.org>
parents:
13448
diff
changeset
|
2367 if(state->mode.report_focus) |
9f857e6310b6
patch 8.0.1639: libvterm code lags behind master
Christian Brabandt <cb@256bit.org>
parents:
13448
diff
changeset
|
2368 vterm_push_output_sprintf_ctrl(state->vt, C1_CSI, "I"); |
9f857e6310b6
patch 8.0.1639: libvterm code lags behind master
Christian Brabandt <cb@256bit.org>
parents:
13448
diff
changeset
|
2369 } |
9f857e6310b6
patch 8.0.1639: libvterm code lags behind master
Christian Brabandt <cb@256bit.org>
parents:
13448
diff
changeset
|
2370 |
9f857e6310b6
patch 8.0.1639: libvterm code lags behind master
Christian Brabandt <cb@256bit.org>
parents:
13448
diff
changeset
|
2371 void vterm_state_focus_out(VTermState *state) |
9f857e6310b6
patch 8.0.1639: libvterm code lags behind master
Christian Brabandt <cb@256bit.org>
parents:
13448
diff
changeset
|
2372 { |
9f857e6310b6
patch 8.0.1639: libvterm code lags behind master
Christian Brabandt <cb@256bit.org>
parents:
13448
diff
changeset
|
2373 if(state->mode.report_focus) |
9f857e6310b6
patch 8.0.1639: libvterm code lags behind master
Christian Brabandt <cb@256bit.org>
parents:
13448
diff
changeset
|
2374 vterm_push_output_sprintf_ctrl(state->vt, C1_CSI, "O"); |
9f857e6310b6
patch 8.0.1639: libvterm code lags behind master
Christian Brabandt <cb@256bit.org>
parents:
13448
diff
changeset
|
2375 } |
9f857e6310b6
patch 8.0.1639: libvterm code lags behind master
Christian Brabandt <cb@256bit.org>
parents:
13448
diff
changeset
|
2376 |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2377 const VTermLineInfo *vterm_state_get_lineinfo(const VTermState *state, int row) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2378 { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2379 return state->lineinfo + row; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2380 } |
26270
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2381 |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2382 void vterm_state_set_selection_callbacks(VTermState *state, const VTermSelectionCallbacks *callbacks, void *user, |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2383 char *buffer, size_t buflen) |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2384 { |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2385 if(buflen && !buffer) |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2386 buffer = vterm_allocator_malloc(state->vt, buflen); |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2387 |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2388 state->selection.callbacks = callbacks; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2389 state->selection.user = user; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2390 state->selection.buffer = buffer; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2391 state->selection.buflen = buflen; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2392 } |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2393 |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2394 void vterm_state_send_selection(VTermState *state, VTermSelectionMask mask, VTermStringFragment frag) |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2395 { |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2396 VTerm *vt = state->vt; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2397 |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2398 if(frag.initial) { |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2399 /* TODO: support sending more than one mask bit */ |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2400 static char selection_chars[] = "cpqs"; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2401 int idx; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2402 for(idx = 0; idx < 4; idx++) |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2403 if(mask & (1 << idx)) |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2404 break; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2405 |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2406 vterm_push_output_sprintf_str(vt, C1_OSC, FALSE, "52;%c;", selection_chars[idx]); |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2407 |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2408 state->tmp.selection.sendpartial = 0; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2409 } |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2410 |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2411 if(frag.len) { |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2412 size_t bufcur = 0; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2413 char *buffer = state->selection.buffer; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2414 |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2415 uint32_t x = 0; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2416 int n = 0; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2417 |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2418 if(state->tmp.selection.sendpartial) { |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2419 n = state->tmp.selection.sendpartial >> 24; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2420 x = state->tmp.selection.sendpartial & 0xFFFFFF; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2421 |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2422 state->tmp.selection.sendpartial = 0; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2423 } |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2424 |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2425 while((state->selection.buflen - bufcur) >= 4 && frag.len) { |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2426 x = (x << 8) | frag.str[0]; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2427 n++; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2428 frag.str++, frag.len--; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2429 |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2430 if(n == 3) { |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2431 buffer[0] = base64_one((x >> 18) & 0x3F); |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2432 buffer[1] = base64_one((x >> 12) & 0x3F); |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2433 buffer[2] = base64_one((x >> 6) & 0x3F); |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2434 buffer[3] = base64_one((x >> 0) & 0x3F); |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2435 |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2436 buffer += 4, bufcur += 4; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2437 x = 0; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2438 n = 0; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2439 } |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2440 |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2441 if(!frag.len || (state->selection.buflen - bufcur) < 4) { |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2442 if(bufcur) |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2443 vterm_push_output_bytes(vt, state->selection.buffer, bufcur); |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2444 |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2445 buffer = state->selection.buffer; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2446 bufcur = 0; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2447 } |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2448 } |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2449 |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2450 if(n) |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2451 state->tmp.selection.sendpartial = (n << 24) | x; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2452 } |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2453 |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2454 if(frag.final) { |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2455 if(state->tmp.selection.sendpartial) { |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2456 int n = state->tmp.selection.sendpartial >> 24; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2457 uint32_t x = state->tmp.selection.sendpartial & 0xFFFFFF; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2458 char *buffer = state->selection.buffer; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2459 |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2460 /* n is either 1 or 2 now */ |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2461 x <<= (n == 1) ? 16 : 8; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2462 |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2463 buffer[0] = base64_one((x >> 18) & 0x3F); |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2464 buffer[1] = base64_one((x >> 12) & 0x3F); |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2465 buffer[2] = (n == 1) ? '=' : base64_one((x >> 6) & 0x3F); |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2466 buffer[3] = '='; |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2467 |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2468 vterm_push_output_sprintf_str(vt, 0, TRUE, "%.*s", 4, buffer); |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2469 } |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2470 else |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2471 vterm_push_output_sprintf_str(vt, 0, TRUE, ""); |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2472 } |
f93337ae0612
patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents:
23890
diff
changeset
|
2473 } |