annotate src/libvterm/include/vterm.h @ 32728:b13f723a7ec6 v9.0.1684

patch 9.0.1684: Update libvterm to rev 839 Commit: https://github.com/vim/vim/commit/b00df7aa388994119346a21d77b0d0db2a0a5e9f Author: zeertzjq <zeertzjq@outlook.com> Date: Tue Aug 8 11:03:00 2023 +0800 patch 9.0.1684: Update libvterm to rev 839 Problem: libvterm slightly outdated Solution: Update libvterm from rev 818 to rev 839 Notable fix: libvterm now handles DECSM/DECRM with multiple arguents, so several ncurses programs (e.g. nnn) can enable mouse properly when run in Vim's terminal in XTerm. closes: #12746 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: zeertzjq <zeertzjq@outlook.com>
author Christian Brabandt <cb@256bit.org>
date Fri, 11 Aug 2023 21:30:03 +0200
parents dcde141f2d1e
children 288bbf09d372
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 /*
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2 * NOTE: This is a MODIFIED version of libvterm, see the README file.
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
3 */
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
4 #ifndef __VTERM_H__
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5 #define __VTERM_H__
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 #ifdef __cplusplus
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 extern "C" {
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9 #endif
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11 #include <stdlib.h>
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13 #include "vterm_keycodes.h"
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14
30880
82336c3b679d patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents: 30876
diff changeset
15 // VIM: use TRUE and FALSE instead of true and false
11780
c76b672df584 patch 8.0.0772: other stdbool.h dependencies in libvterm
Christian Brabandt <cb@256bit.org>
parents: 11761
diff changeset
16 #define TRUE 1
c76b672df584 patch 8.0.0772: other stdbool.h dependencies in libvterm
Christian Brabandt <cb@256bit.org>
parents: 11761
diff changeset
17 #define FALSE 0
c76b672df584 patch 8.0.0772: other stdbool.h dependencies in libvterm
Christian Brabandt <cb@256bit.org>
parents: 11761
diff changeset
18
30880
82336c3b679d patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents: 30876
diff changeset
19 // VIM: from stdint.h
11830
edc806552a60 patch 8.0.0795: terminal feature does not build with older MSVC
Christian Brabandt <cb@256bit.org>
parents: 11780
diff changeset
20 typedef unsigned char uint8_t;
26270
f93337ae0612 patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents: 26193
diff changeset
21 typedef unsigned short uint16_t;
11830
edc806552a60 patch 8.0.0795: terminal feature does not build with older MSVC
Christian Brabandt <cb@256bit.org>
parents: 11780
diff changeset
22 typedef unsigned int uint32_t;
edc806552a60 patch 8.0.0795: terminal feature does not build with older MSVC
Christian Brabandt <cb@256bit.org>
parents: 11780
diff changeset
23
20462
9ad473b50471 patch 8.2.0785: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20460
diff changeset
24 #define VTERM_VERSION_MAJOR 0
30880
82336c3b679d patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents: 30876
diff changeset
25 #define VTERM_VERSION_MINOR 3
32728
b13f723a7ec6 patch 9.0.1684: Update libvterm to rev 839
Christian Brabandt <cb@256bit.org>
parents: 31192
diff changeset
26 #define VTERM_VERSION_PATCH 3
20462
9ad473b50471 patch 8.2.0785: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20460
diff changeset
27
9ad473b50471 patch 8.2.0785: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20460
diff changeset
28 #define VTERM_CHECK_VERSION \
9ad473b50471 patch 8.2.0785: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20460
diff changeset
29 vterm_check_version(VTERM_VERSION_MAJOR, VTERM_VERSION_MINOR)
9ad473b50471 patch 8.2.0785: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20460
diff changeset
30
30876
2d2758ffd959 patch 9.0.0772: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents: 26270
diff changeset
31 /* Any cell can contain at most one basic printing character and 5 combining
2d2758ffd959 patch 9.0.0772: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents: 26270
diff changeset
32 * characters. This number could be changed but will be ABI-incompatible if
2d2758ffd959 patch 9.0.0772: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents: 26270
diff changeset
33 * you do */
2d2758ffd959 patch 9.0.0772: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents: 26270
diff changeset
34 #define VTERM_MAX_CHARS_PER_CELL 6
2d2758ffd959 patch 9.0.0772: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents: 26270
diff changeset
35
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
36 typedef struct VTerm VTerm;
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
37 typedef struct VTermState VTermState;
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
38 typedef struct VTermScreen VTermScreen;
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
39
17777
811a12a78164 patch 8.1.1885: comments in libvterm are inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 13770
diff changeset
40 // Specifies a screen point.
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
41 typedef struct {
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
42 int row;
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
43 int col;
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
44 } VTermPos;
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
45
20518
a4652d7ec99f patch 8.2.0813: libvterm code is slightly different from upstream
Bram Moolenaar <Bram@vim.org>
parents: 20500
diff changeset
46 /* some small utility functions; we can just keep these static here */
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
47
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
48 /*
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
49 * Order points by on-screen flow order:
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
50 * Return < 0 if "a" is before "b"
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
51 * Return 0 if "a" and "b" are equal
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
52 * Return > 0 if "a" is after "b".
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
53 */
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
54 int vterm_pos_cmp(VTermPos a, VTermPos b);
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
55
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
56 #if defined(DEFINE_INLINES) || USE_INLINE
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
57 INLINE int vterm_pos_cmp(VTermPos a, VTermPos b)
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
58 {
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
59 return (a.row == b.row) ? a.col - b.col : a.row - b.row;
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 #endif
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
62
17777
811a12a78164 patch 8.1.1885: comments in libvterm are inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 13770
diff changeset
63 // Specifies a rectangular screen area.
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
64 typedef struct {
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
65 int start_row;
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
66 int end_row;
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
67 int start_col;
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
68 int end_col;
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
69 } VTermRect;
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
70
20518
a4652d7ec99f patch 8.2.0813: libvterm code is slightly different from upstream
Bram Moolenaar <Bram@vim.org>
parents: 20500
diff changeset
71 /* true if the rect contains the point */
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
72 int vterm_rect_contains(VTermRect r, VTermPos p);
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
73
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
74 #if defined(DEFINE_INLINES) || USE_INLINE
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
75 INLINE int vterm_rect_contains(VTermRect r, VTermPos p)
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 return p.row >= r.start_row && p.row < r.end_row &&
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
78 p.col >= r.start_col && p.col < r.end_col;
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
79 }
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
80 #endif
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
81
20518
a4652d7ec99f patch 8.2.0813: libvterm code is slightly different from upstream
Bram Moolenaar <Bram@vim.org>
parents: 20500
diff changeset
82 /* move a rect */
17777
811a12a78164 patch 8.1.1885: comments in libvterm are inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 13770
diff changeset
83 // Move "rect" "row_delta" down and "col_delta" right.
811a12a78164 patch 8.1.1885: comments in libvterm are inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 13770
diff changeset
84 // Does not check boundaries.
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
85 void vterm_rect_move(VTermRect *rect, int row_delta, int col_delta);
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
86
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
87 #if defined(DEFINE_INLINES) || USE_INLINE
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
88 INLINE void vterm_rect_move(VTermRect *rect, int row_delta, int col_delta)
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
89 {
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
90 rect->start_row += row_delta; rect->end_row += row_delta;
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
91 rect->start_col += col_delta; rect->end_col += col_delta;
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
92 }
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
93 #endif
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
94
20500
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
95 /**
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
96 * Bit-field describing the value of VTermColor.type
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
97 */
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
98 typedef enum {
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
99 /**
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
100 * If the lower bit of `type` is not set, the colour is 24-bit RGB.
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
101 */
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
102 VTERM_COLOR_RGB = 0x00,
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
103
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
104 /**
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
105 * The colour is an index into a palette of 256 colours.
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
106 */
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
107 VTERM_COLOR_INDEXED = 0x01,
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
108
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
109 /**
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
110 * Mask that can be used to extract the RGB/Indexed bit.
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
111 */
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
112 VTERM_COLOR_TYPE_MASK = 0x01,
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
113
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
114 /**
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
115 * If set, indicates that this colour should be the default foreground
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
116 * color, i.e. there was no SGR request for another colour. When
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
117 * rendering this colour it is possible to ignore "idx" and just use a
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
118 * colour that is not in the palette.
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
119 */
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
120 VTERM_COLOR_DEFAULT_FG = 0x02,
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
121
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
122 /**
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
123 * If set, indicates that this colour should be the default background
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
124 * color, i.e. there was no SGR request for another colour. A common
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
125 * option when rendering this colour is to not render a background at
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
126 * all, for example by rendering the window transparently at this spot.
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
127 */
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
128 VTERM_COLOR_DEFAULT_BG = 0x04,
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
129
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
130 /**
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
131 * Mask that can be used to extract the default foreground/background bit.
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
132 */
26193
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 20518
diff changeset
133 VTERM_COLOR_DEFAULT_MASK = 0x06,
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 20518
diff changeset
134
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 20518
diff changeset
135 /**
30880
82336c3b679d patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents: 30876
diff changeset
136 * VIM: If set, indicates that the color is invalid.
26193
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 20518
diff changeset
137 */
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 20518
diff changeset
138 VTERM_COLOR_INVALID = 0x08
20500
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
139 } VTermColorType;
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
140
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
141 /**
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
142 * Returns true if the VTERM_COLOR_RGB `type` flag is set, indicating that the
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
143 * given VTermColor instance is an indexed colour.
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
144 */
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
145 #define VTERM_COLOR_IS_INDEXED(col) \
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
146 (((col)->type & VTERM_COLOR_TYPE_MASK) == VTERM_COLOR_INDEXED)
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
147
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
148 /**
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
149 * Returns true if the VTERM_COLOR_INDEXED `type` flag is set, indicating that
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
150 * the given VTermColor instance is an rgb colour.
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
151 */
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
152 #define VTERM_COLOR_IS_RGB(col) \
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
153 (((col)->type & VTERM_COLOR_TYPE_MASK) == VTERM_COLOR_RGB)
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
154
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
155 /**
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
156 * Returns true if the VTERM_COLOR_DEFAULT_FG `type` flag is set, indicating
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
157 * that the given VTermColor instance corresponds to the default foreground
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
158 * color.
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
159 */
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
160 #define VTERM_COLOR_IS_DEFAULT_FG(col) \
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
161 (!!((col)->type & VTERM_COLOR_DEFAULT_FG))
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
162
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
163 /**
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
164 * Returns true if the VTERM_COLOR_DEFAULT_BG `type` flag is set, indicating
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
165 * that the given VTermColor instance corresponds to the default background
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
166 * color.
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
167 */
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
168 #define VTERM_COLOR_IS_DEFAULT_BG(col) \
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
169 (!!((col)->type & VTERM_COLOR_DEFAULT_BG))
12966
c5bccd50100e patch 8.0.1359: libvterm ANSI colors can not always be recognized
Christian Brabandt <cb@256bit.org>
parents: 12076
diff changeset
170
26193
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 20518
diff changeset
171 /**
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 20518
diff changeset
172 * Returns true if the VTERM_COLOR_INVALID `type` flag is set, indicating
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 20518
diff changeset
173 * that the given VTermColor instance is an invalid color.
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 20518
diff changeset
174 */
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 20518
diff changeset
175 #define VTERM_COLOR_IS_INVALID(col) (!!((col)->type & VTERM_COLOR_INVALID))
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 20518
diff changeset
176
30880
82336c3b679d patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents: 30876
diff changeset
177 // VIM: this was a union, but that doesn't always work.
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
178 typedef struct {
20500
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
179 /**
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
180 * Tag indicating which member is actually valid.
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
181 * Please use the `VTERM_COLOR_IS_*` test macros to check whether a
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
182 * particular type flag is set.
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
183 */
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
184 uint8_t type;
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
185
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
186 uint8_t red, green, blue;
20500
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
187
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
188 uint8_t index;
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
189 } VTermColor;
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
190
20500
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
191 /**
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
192 * Constructs a new VTermColor instance representing the given RGB values.
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
193 */
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
194 void vterm_color_rgb(VTermColor *col, uint8_t red, uint8_t green, uint8_t blue);
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
195
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
196 /**
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
197 * Construct a new VTermColor instance representing an indexed color with the
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
198 * given index.
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
199 */
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
200 void vterm_color_indexed(VTermColor *col, uint8_t idx);
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
201
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
202 /**
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
203 * Compares two colours. Returns true if the colors are equal, false otherwise.
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
204 */
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
205 int vterm_color_is_equal(const VTermColor *a, const VTermColor *b);
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
206
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
207 typedef enum {
20518
a4652d7ec99f patch 8.2.0813: libvterm code is slightly different from upstream
Bram Moolenaar <Bram@vim.org>
parents: 20500
diff changeset
208 /* VTERM_VALUETYPE_NONE = 0 */
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
209 VTERM_VALUETYPE_BOOL = 1,
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
210 VTERM_VALUETYPE_INT,
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
211 VTERM_VALUETYPE_STRING,
13531
9f857e6310b6 patch 8.0.1639: libvterm code lags behind master
Christian Brabandt <cb@256bit.org>
parents: 13448
diff changeset
212 VTERM_VALUETYPE_COLOR,
9f857e6310b6 patch 8.0.1639: libvterm code lags behind master
Christian Brabandt <cb@256bit.org>
parents: 13448
diff changeset
213
9f857e6310b6 patch 8.0.1639: libvterm code lags behind master
Christian Brabandt <cb@256bit.org>
parents: 13448
diff changeset
214 VTERM_N_VALUETYPES
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
215 } VTermValueType;
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
216
20488
1d595fada804 patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20482
diff changeset
217 typedef struct {
1d595fada804 patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20482
diff changeset
218 const char *str;
1d595fada804 patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20482
diff changeset
219 size_t len : 30;
1d595fada804 patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20482
diff changeset
220 unsigned int initial : 1;
1d595fada804 patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20482
diff changeset
221 unsigned int final : 1;
1d595fada804 patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20482
diff changeset
222 } VTermStringFragment;
1d595fada804 patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20482
diff changeset
223
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
224 typedef union {
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
225 int boolean;
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
226 int number;
20488
1d595fada804 patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20482
diff changeset
227 VTermStringFragment string;
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
228 VTermColor color;
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
229 } VTermValue;
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
230
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
231 typedef enum {
20518
a4652d7ec99f patch 8.2.0813: libvterm code is slightly different from upstream
Bram Moolenaar <Bram@vim.org>
parents: 20500
diff changeset
232 /* VTERM_ATTR_NONE = 0 */
13770
2449b6ce1456 patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents: 13531
diff changeset
233 VTERM_ATTR_BOLD = 1, // bool: 1, 22
2449b6ce1456 patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents: 13531
diff changeset
234 VTERM_ATTR_UNDERLINE, // number: 4, 21, 24
2449b6ce1456 patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents: 13531
diff changeset
235 VTERM_ATTR_ITALIC, // bool: 3, 23
2449b6ce1456 patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents: 13531
diff changeset
236 VTERM_ATTR_BLINK, // bool: 5, 25
2449b6ce1456 patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents: 13531
diff changeset
237 VTERM_ATTR_REVERSE, // bool: 7, 27
20496
747a270eb1db patch 8.2.0802: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20488
diff changeset
238 VTERM_ATTR_CONCEAL, // bool: 8, 28
13770
2449b6ce1456 patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents: 13531
diff changeset
239 VTERM_ATTR_STRIKE, // bool: 9, 29
2449b6ce1456 patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents: 13531
diff changeset
240 VTERM_ATTR_FONT, // number: 10-19
2449b6ce1456 patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents: 13531
diff changeset
241 VTERM_ATTR_FOREGROUND, // color: 30-39 90-97
2449b6ce1456 patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents: 13531
diff changeset
242 VTERM_ATTR_BACKGROUND, // color: 40-49 100-107
30880
82336c3b679d patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents: 30876
diff changeset
243 VTERM_ATTR_SMALL, // bool: 73, 74, 75
82336c3b679d patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents: 30876
diff changeset
244 VTERM_ATTR_BASELINE, // number: 73, 74, 75
13531
9f857e6310b6 patch 8.0.1639: libvterm code lags behind master
Christian Brabandt <cb@256bit.org>
parents: 13448
diff changeset
245
9f857e6310b6 patch 8.0.1639: libvterm code lags behind master
Christian Brabandt <cb@256bit.org>
parents: 13448
diff changeset
246 VTERM_N_ATTRS
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
247 } VTermAttr;
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 typedef enum {
20518
a4652d7ec99f patch 8.2.0813: libvterm code is slightly different from upstream
Bram Moolenaar <Bram@vim.org>
parents: 20500
diff changeset
250 /* VTERM_PROP_NONE = 0 */
13770
2449b6ce1456 patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents: 13531
diff changeset
251 VTERM_PROP_CURSORVISIBLE = 1, // bool
2449b6ce1456 patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents: 13531
diff changeset
252 VTERM_PROP_CURSORBLINK, // bool
2449b6ce1456 patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents: 13531
diff changeset
253 VTERM_PROP_ALTSCREEN, // bool
2449b6ce1456 patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents: 13531
diff changeset
254 VTERM_PROP_TITLE, // string
2449b6ce1456 patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents: 13531
diff changeset
255 VTERM_PROP_ICONNAME, // string
2449b6ce1456 patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents: 13531
diff changeset
256 VTERM_PROP_REVERSE, // bool
2449b6ce1456 patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents: 13531
diff changeset
257 VTERM_PROP_CURSORSHAPE, // number
2449b6ce1456 patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents: 13531
diff changeset
258 VTERM_PROP_MOUSE, // number
32728
b13f723a7ec6 patch 9.0.1684: Update libvterm to rev 839
Christian Brabandt <cb@256bit.org>
parents: 31192
diff changeset
259 VTERM_PROP_FOCUSREPORT, // bool
30880
82336c3b679d patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents: 30876
diff changeset
260 VTERM_PROP_CURSORCOLOR, // VIM - string
13531
9f857e6310b6 patch 8.0.1639: libvterm code lags behind master
Christian Brabandt <cb@256bit.org>
parents: 13448
diff changeset
261
9f857e6310b6 patch 8.0.1639: libvterm code lags behind master
Christian Brabandt <cb@256bit.org>
parents: 13448
diff changeset
262 VTERM_N_PROPS
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
263 } VTermProp;
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
264
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
265 enum {
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
266 VTERM_PROP_CURSORSHAPE_BLOCK = 1,
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
267 VTERM_PROP_CURSORSHAPE_UNDERLINE,
13531
9f857e6310b6 patch 8.0.1639: libvterm code lags behind master
Christian Brabandt <cb@256bit.org>
parents: 13448
diff changeset
268 VTERM_PROP_CURSORSHAPE_BAR_LEFT,
9f857e6310b6 patch 8.0.1639: libvterm code lags behind master
Christian Brabandt <cb@256bit.org>
parents: 13448
diff changeset
269
9f857e6310b6 patch 8.0.1639: libvterm code lags behind master
Christian Brabandt <cb@256bit.org>
parents: 13448
diff changeset
270 VTERM_N_PROP_CURSORSHAPES
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
271 };
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 enum {
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
274 VTERM_PROP_MOUSE_NONE = 0,
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
275 VTERM_PROP_MOUSE_CLICK,
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
276 VTERM_PROP_MOUSE_DRAG,
13531
9f857e6310b6 patch 8.0.1639: libvterm code lags behind master
Christian Brabandt <cb@256bit.org>
parents: 13448
diff changeset
277 VTERM_PROP_MOUSE_MOVE,
9f857e6310b6 patch 8.0.1639: libvterm code lags behind master
Christian Brabandt <cb@256bit.org>
parents: 13448
diff changeset
278
9f857e6310b6 patch 8.0.1639: libvterm code lags behind master
Christian Brabandt <cb@256bit.org>
parents: 13448
diff changeset
279 VTERM_N_PROP_MOUSES
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
280 };
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
281
26270
f93337ae0612 patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents: 26193
diff changeset
282 typedef enum {
f93337ae0612 patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents: 26193
diff changeset
283 VTERM_SELECTION_CLIPBOARD = (1<<0),
f93337ae0612 patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents: 26193
diff changeset
284 VTERM_SELECTION_PRIMARY = (1<<1),
f93337ae0612 patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents: 26193
diff changeset
285 VTERM_SELECTION_SECONDARY = (1<<2),
f93337ae0612 patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents: 26193
diff changeset
286 VTERM_SELECTION_SELECT = (1<<3),
f93337ae0612 patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents: 26193
diff changeset
287 VTERM_SELECTION_CUT0 = (1<<4), /* also CUT1 .. CUT7 by bitshifting */
f93337ae0612 patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents: 26193
diff changeset
288 } VTermSelectionMask;
f93337ae0612 patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents: 26193
diff changeset
289
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
290 typedef struct {
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
291 const uint32_t *chars;
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
292 int width;
20518
a4652d7ec99f patch 8.2.0813: libvterm code is slightly different from upstream
Bram Moolenaar <Bram@vim.org>
parents: 20500
diff changeset
293 unsigned int protected_cell:1; /* DECSCA-protected against DECSEL/DECSED */
a4652d7ec99f patch 8.2.0813: libvterm code is slightly different from upstream
Bram Moolenaar <Bram@vim.org>
parents: 20500
diff changeset
294 unsigned int dwl:1; /* DECDWL or DECDHL double-width line */
a4652d7ec99f patch 8.2.0813: libvterm code is slightly different from upstream
Bram Moolenaar <Bram@vim.org>
parents: 20500
diff changeset
295 unsigned int dhl:2; /* DECDHL double-height line (1=top 2=bottom) */
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
296 } VTermGlyphInfo;
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
297
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
298 typedef struct {
20482
dc88c690f19b patch 8.2.0795: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20480
diff changeset
299 unsigned int doublewidth:1; /* DECDWL or DECDHL line */
dc88c690f19b patch 8.2.0795: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20480
diff changeset
300 unsigned int doubleheight:2; /* DECDHL line (1=top 2=bottom) */
dc88c690f19b patch 8.2.0795: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20480
diff changeset
301 unsigned int continuation:1; /* Line is a flow continuation of the previous */
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
302 } VTermLineInfo;
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
303
20518
a4652d7ec99f patch 8.2.0813: libvterm code is slightly different from upstream
Bram Moolenaar <Bram@vim.org>
parents: 20500
diff changeset
304 /* Copies of VTermState fields that the 'resize' callback might have reason to
a4652d7ec99f patch 8.2.0813: libvterm code is slightly different from upstream
Bram Moolenaar <Bram@vim.org>
parents: 20500
diff changeset
305 * edit. 'resize' callback gets total control of these fields and may
a4652d7ec99f patch 8.2.0813: libvterm code is slightly different from upstream
Bram Moolenaar <Bram@vim.org>
parents: 20500
diff changeset
306 * free-and-reallocate them if required. They will be copied back from the
a4652d7ec99f patch 8.2.0813: libvterm code is slightly different from upstream
Bram Moolenaar <Bram@vim.org>
parents: 20500
diff changeset
307 * struct after the callback has returned.
a4652d7ec99f patch 8.2.0813: libvterm code is slightly different from upstream
Bram Moolenaar <Bram@vim.org>
parents: 20500
diff changeset
308 */
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
309 typedef struct {
20518
a4652d7ec99f patch 8.2.0813: libvterm code is slightly different from upstream
Bram Moolenaar <Bram@vim.org>
parents: 20500
diff changeset
310 VTermPos pos; /* current cursor position */
30876
2d2758ffd959 patch 9.0.0772: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents: 26270
diff changeset
311 VTermLineInfo *lineinfos[2]; /* [1] may be NULL */
20518
a4652d7ec99f patch 8.2.0813: libvterm code is slightly different from upstream
Bram Moolenaar <Bram@vim.org>
parents: 20500
diff changeset
312 } VTermStateFields;
a4652d7ec99f patch 8.2.0813: libvterm code is slightly different from upstream
Bram Moolenaar <Bram@vim.org>
parents: 20500
diff changeset
313
a4652d7ec99f patch 8.2.0813: libvterm code is slightly different from upstream
Bram Moolenaar <Bram@vim.org>
parents: 20500
diff changeset
314 typedef struct {
a4652d7ec99f patch 8.2.0813: libvterm code is slightly different from upstream
Bram Moolenaar <Bram@vim.org>
parents: 20500
diff changeset
315 /* libvterm relies on this memory to be zeroed out before it is returned
a4652d7ec99f patch 8.2.0813: libvterm code is slightly different from upstream
Bram Moolenaar <Bram@vim.org>
parents: 20500
diff changeset
316 * by the allocator. */
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
317 void *(*malloc)(size_t size, void *allocdata);
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
318 void (*free)(void *ptr, void *allocdata);
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
319 } VTermAllocatorFunctions;
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
320
20462
9ad473b50471 patch 8.2.0785: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20460
diff changeset
321 void vterm_check_version(int major, int minor);
9ad473b50471 patch 8.2.0785: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20460
diff changeset
322
30876
2d2758ffd959 patch 9.0.0772: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents: 26270
diff changeset
323 struct VTermBuilder {
2d2758ffd959 patch 9.0.0772: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents: 26270
diff changeset
324 int ver; /* currently unused but reserved for some sort of ABI version flag */
2d2758ffd959 patch 9.0.0772: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents: 26270
diff changeset
325
2d2758ffd959 patch 9.0.0772: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents: 26270
diff changeset
326 int rows, cols;
2d2758ffd959 patch 9.0.0772: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents: 26270
diff changeset
327
2d2758ffd959 patch 9.0.0772: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents: 26270
diff changeset
328 const VTermAllocatorFunctions *allocator;
2d2758ffd959 patch 9.0.0772: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents: 26270
diff changeset
329 void *allocdata;
2d2758ffd959 patch 9.0.0772: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents: 26270
diff changeset
330
2d2758ffd959 patch 9.0.0772: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents: 26270
diff changeset
331 /* Override default sizes for various structures */
2d2758ffd959 patch 9.0.0772: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents: 26270
diff changeset
332 size_t outbuffer_len; /* default: 4096 */
2d2758ffd959 patch 9.0.0772: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents: 26270
diff changeset
333 size_t tmpbuffer_len; /* default: 4096 */
2d2758ffd959 patch 9.0.0772: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents: 26270
diff changeset
334 };
2d2758ffd959 patch 9.0.0772: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents: 26270
diff changeset
335
2d2758ffd959 patch 9.0.0772: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents: 26270
diff changeset
336 VTerm *vterm_build(const struct VTermBuilder *builder);
2d2758ffd959 patch 9.0.0772: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents: 26270
diff changeset
337
2d2758ffd959 patch 9.0.0772: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents: 26270
diff changeset
338 /* A convenient shortcut for default cases */
17777
811a12a78164 patch 8.1.1885: comments in libvterm are inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 13770
diff changeset
339 // Allocate and initialize a new terminal with default allocators.
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
340 VTerm *vterm_new(int rows, int cols);
30876
2d2758ffd959 patch 9.0.0772: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents: 26270
diff changeset
341 /* These shortcuts are generally discouraged in favour of just using vterm_build() */
2d2758ffd959 patch 9.0.0772: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents: 26270
diff changeset
342
17777
811a12a78164 patch 8.1.1885: comments in libvterm are inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 13770
diff changeset
343 // Allocate and initialize a new terminal with specified allocators.
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
344 VTerm *vterm_new_with_allocator(int rows, int cols, VTermAllocatorFunctions *funcs, void *allocdata);
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
345
17777
811a12a78164 patch 8.1.1885: comments in libvterm are inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 13770
diff changeset
346 // Free and cleanup a terminal and all its data.
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
347 void vterm_free(VTerm* vt);
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
348
17777
811a12a78164 patch 8.1.1885: comments in libvterm are inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 13770
diff changeset
349 // Get the current size of the terminal and store in "rowsp" and "colsp".
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
350 void vterm_get_size(const VTerm *vt, int *rowsp, int *colsp);
11761
7846efd291d7 patch 8.0.0763: libvterm can be improved
Christian Brabandt <cb@256bit.org>
parents: 11621
diff changeset
351
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
352 void vterm_set_size(VTerm *vt, int rows, int cols);
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
353
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
354 int vterm_get_utf8(const VTerm *vt);
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
355 void vterm_set_utf8(VTerm *vt, int is_utf8);
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 size_t vterm_input_write(VTerm *vt, const char *bytes, size_t len);
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
358
20460
c15dd3da4f47 patch 8.2.0784: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 18802
diff changeset
359 /* Setting output callback will override the buffer logic */
c15dd3da4f47 patch 8.2.0784: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 18802
diff changeset
360 typedef void VTermOutputCallback(const char *s, size_t len, void *user);
c15dd3da4f47 patch 8.2.0784: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 18802
diff changeset
361 void vterm_output_set_callback(VTerm *vt, VTermOutputCallback *func, void *user);
c15dd3da4f47 patch 8.2.0784: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 18802
diff changeset
362
c15dd3da4f47 patch 8.2.0784: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 18802
diff changeset
363 /* These buffer functions only work if output callback is NOT set
c15dd3da4f47 patch 8.2.0784: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 18802
diff changeset
364 * These are deprecated and will be removed in a later version */
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
365 size_t vterm_output_get_buffer_size(const VTerm *vt);
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
366 size_t vterm_output_get_buffer_current(const VTerm *vt);
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
367 size_t vterm_output_get_buffer_remaining(const VTerm *vt);
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
368
20460
c15dd3da4f47 patch 8.2.0784: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 18802
diff changeset
369 /* This too */
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
370 size_t vterm_output_read(VTerm *vt, char *buffer, size_t len);
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
371
18279
e8d1f3209dcd patch 8.1.2134: modifier keys are not always recognized
Bram Moolenaar <Bram@vim.org>
parents: 17777
diff changeset
372 int vterm_is_modify_other_keys(VTerm *vt);
31192
dcde141f2d1e patch 9.0.0930: cannot debug the Kitty keyboard protocol with TermDebug
Bram Moolenaar <Bram@vim.org>
parents: 30894
diff changeset
373 int vterm_is_kitty_keyboard(VTerm *vt);
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
374 void vterm_keyboard_unichar(VTerm *vt, uint32_t c, VTermModifier mod);
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
375 void vterm_keyboard_key(VTerm *vt, VTermKey key, VTermModifier mod);
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
376
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
377 void vterm_keyboard_start_paste(VTerm *vt);
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
378 void vterm_keyboard_end_paste(VTerm *vt);
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
379
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
380 void vterm_mouse_move(VTerm *vt, int row, int col, VTermModifier mod);
17777
811a12a78164 patch 8.1.1885: comments in libvterm are inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 13770
diff changeset
381 // "button" is 1 for left, 2 for middle, 3 for right.
811a12a78164 patch 8.1.1885: comments in libvterm are inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 13770
diff changeset
382 // Button 4 is scroll wheel down, button 5 is scroll wheel up.
11780
c76b672df584 patch 8.0.0772: other stdbool.h dependencies in libvterm
Christian Brabandt <cb@256bit.org>
parents: 11761
diff changeset
383 void vterm_mouse_button(VTerm *vt, int button, int pressed, VTermModifier mod);
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
384
13770
2449b6ce1456 patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents: 13531
diff changeset
385 // ------------
2449b6ce1456 patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents: 13531
diff changeset
386 // Parser layer
2449b6ce1456 patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents: 13531
diff changeset
387 // ------------
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
388
20518
a4652d7ec99f patch 8.2.0813: libvterm code is slightly different from upstream
Bram Moolenaar <Bram@vim.org>
parents: 20500
diff changeset
389 /* Flag to indicate non-final subparameters in a single CSI parameter.
a4652d7ec99f patch 8.2.0813: libvterm code is slightly different from upstream
Bram Moolenaar <Bram@vim.org>
parents: 20500
diff changeset
390 * Consider
a4652d7ec99f patch 8.2.0813: libvterm code is slightly different from upstream
Bram Moolenaar <Bram@vim.org>
parents: 20500
diff changeset
391 * CSI 1;2:3:4;5a
a4652d7ec99f patch 8.2.0813: libvterm code is slightly different from upstream
Bram Moolenaar <Bram@vim.org>
parents: 20500
diff changeset
392 * 1 4 and 5 are final.
a4652d7ec99f patch 8.2.0813: libvterm code is slightly different from upstream
Bram Moolenaar <Bram@vim.org>
parents: 20500
diff changeset
393 * 2 and 3 are non-final and will have this bit set
a4652d7ec99f patch 8.2.0813: libvterm code is slightly different from upstream
Bram Moolenaar <Bram@vim.org>
parents: 20500
diff changeset
394 *
a4652d7ec99f patch 8.2.0813: libvterm code is slightly different from upstream
Bram Moolenaar <Bram@vim.org>
parents: 20500
diff changeset
395 * Don't confuse this with the final byte of the CSI escape; 'a' in this case.
a4652d7ec99f patch 8.2.0813: libvterm code is slightly different from upstream
Bram Moolenaar <Bram@vim.org>
parents: 20500
diff changeset
396 */
13531
9f857e6310b6 patch 8.0.1639: libvterm code lags behind master
Christian Brabandt <cb@256bit.org>
parents: 13448
diff changeset
397 #define CSI_ARG_FLAG_MORE (1U<<31)
9f857e6310b6 patch 8.0.1639: libvterm code lags behind master
Christian Brabandt <cb@256bit.org>
parents: 13448
diff changeset
398 #define CSI_ARG_MASK (~(1U<<31))
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
399
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
400 #define CSI_ARG_HAS_MORE(a) ((a) & CSI_ARG_FLAG_MORE)
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
401 #define CSI_ARG(a) ((a) & CSI_ARG_MASK)
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
402
20518
a4652d7ec99f patch 8.2.0813: libvterm code is slightly different from upstream
Bram Moolenaar <Bram@vim.org>
parents: 20500
diff changeset
403 /* Can't use -1 to indicate a missing argument; use this instead */
30880
82336c3b679d patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents: 30876
diff changeset
404 // VIM: changed 31 to 30 to avoid an overflow warning
11761
7846efd291d7 patch 8.0.0763: libvterm can be improved
Christian Brabandt <cb@256bit.org>
parents: 11621
diff changeset
405 #define CSI_ARG_MISSING ((1<<30)-1)
11621
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 #define CSI_ARG_IS_MISSING(a) (CSI_ARG(a) == CSI_ARG_MISSING)
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
408 #define CSI_ARG_OR(a,def) (CSI_ARG(a) == CSI_ARG_MISSING ? (def) : CSI_ARG(a))
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
409 #define CSI_ARG_COUNT(a) (CSI_ARG(a) == CSI_ARG_MISSING || CSI_ARG(a) == 0 ? 1 : CSI_ARG(a))
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
410
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
411 typedef struct {
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
412 int (*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
413 int (*control)(unsigned char control, void *user);
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
414 int (*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
415 int (*csi)(const char *leader, const long args[], int argcount, const char *intermed, char command, void *user);
20488
1d595fada804 patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20482
diff changeset
416 int (*osc)(int command, VTermStringFragment frag, void *user);
1d595fada804 patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20482
diff changeset
417 int (*dcs)(const char *command, size_t commandlen, VTermStringFragment frag, void *user);
26270
f93337ae0612 patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents: 26193
diff changeset
418 int (*apc)(VTermStringFragment frag, void *user);
f93337ae0612 patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents: 26193
diff changeset
419 int (*pm)(VTermStringFragment frag, void *user);
f93337ae0612 patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents: 26193
diff changeset
420 int (*sos)(VTermStringFragment frag, void *user);
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
421 int (*resize)(int rows, int cols, void *user);
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
422 } VTermParserCallbacks;
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
423
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
424 void vterm_parser_set_callbacks(VTerm *vt, const VTermParserCallbacks *callbacks, void *user);
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
425 void *vterm_parser_get_cbdata(VTerm *vt);
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
426
32728
b13f723a7ec6 patch 9.0.1684: Update libvterm to rev 839
Christian Brabandt <cb@256bit.org>
parents: 31192
diff changeset
427 /* Normally NUL, CAN, SUB and DEL are ignored. Setting this true causes them
b13f723a7ec6 patch 9.0.1684: Update libvterm to rev 839
Christian Brabandt <cb@256bit.org>
parents: 31192
diff changeset
428 * to be emitted by the 'control' callback
b13f723a7ec6 patch 9.0.1684: Update libvterm to rev 839
Christian Brabandt <cb@256bit.org>
parents: 31192
diff changeset
429 */
b13f723a7ec6 patch 9.0.1684: Update libvterm to rev 839
Christian Brabandt <cb@256bit.org>
parents: 31192
diff changeset
430 void vterm_parser_set_emit_nul(VTerm *vt, int emit);
b13f723a7ec6 patch 9.0.1684: Update libvterm to rev 839
Christian Brabandt <cb@256bit.org>
parents: 31192
diff changeset
431
13770
2449b6ce1456 patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents: 13531
diff changeset
432 // -----------
2449b6ce1456 patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents: 13531
diff changeset
433 // State layer
2449b6ce1456 patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents: 13531
diff changeset
434 // -----------
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
435
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
436 typedef struct {
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
437 int (*putglyph)(VTermGlyphInfo *info, VTermPos pos, void *user);
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
438 int (*movecursor)(VTermPos pos, VTermPos oldpos, int visible, void *user);
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
439 int (*scrollrect)(VTermRect rect, int downward, int rightward, void *user);
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
440 int (*moverect)(VTermRect dest, VTermRect src, void *user);
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
441 int (*erase)(VTermRect rect, int selective, void *user);
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
442 int (*initpen)(void *user);
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
443 int (*setpenattr)(VTermAttr attr, VTermValue *val, void *user);
17777
811a12a78164 patch 8.1.1885: comments in libvterm are inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 13770
diff changeset
444 // Callback for setting various properties. Must return 1 if the property
811a12a78164 patch 8.1.1885: comments in libvterm are inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 13770
diff changeset
445 // was accepted, 0 otherwise.
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
446 int (*settermprop)(VTermProp prop, VTermValue *val, void *user);
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
447 int (*bell)(void *user);
20480
d0bf39eb2b07 patch 8.2.0794: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20462
diff changeset
448 int (*resize)(int rows, int cols, VTermStateFields *fields, void *user);
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
449 int (*setlineinfo)(int row, const VTermLineInfo *newinfo, const VTermLineInfo *oldinfo, void *user);
30880
82336c3b679d patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents: 30876
diff changeset
450 int (*sb_clear)(void *user);
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
451 } VTermStateCallbacks;
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
452
30880
82336c3b679d patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents: 30876
diff changeset
453 // VIM: added
13448
a62b0bbc8834 patch 8.0.1598: cannot select text in a terminal with the mouse
Christian Brabandt <cb@256bit.org>
parents: 12966
diff changeset
454 typedef struct {
a62b0bbc8834 patch 8.0.1598: cannot select text in a terminal with the mouse
Christian Brabandt <cb@256bit.org>
parents: 12966
diff changeset
455 VTermPos pos;
a62b0bbc8834 patch 8.0.1598: cannot select text in a terminal with the mouse
Christian Brabandt <cb@256bit.org>
parents: 12966
diff changeset
456 int buttons;
a62b0bbc8834 patch 8.0.1598: cannot select text in a terminal with the mouse
Christian Brabandt <cb@256bit.org>
parents: 12966
diff changeset
457 #define MOUSE_BUTTON_LEFT 0x01
a62b0bbc8834 patch 8.0.1598: cannot select text in a terminal with the mouse
Christian Brabandt <cb@256bit.org>
parents: 12966
diff changeset
458 #define MOUSE_BUTTON_MIDDLE 0x02
a62b0bbc8834 patch 8.0.1598: cannot select text in a terminal with the mouse
Christian Brabandt <cb@256bit.org>
parents: 12966
diff changeset
459 #define MOUSE_BUTTON_RIGHT 0x04
a62b0bbc8834 patch 8.0.1598: cannot select text in a terminal with the mouse
Christian Brabandt <cb@256bit.org>
parents: 12966
diff changeset
460 int flags;
a62b0bbc8834 patch 8.0.1598: cannot select text in a terminal with the mouse
Christian Brabandt <cb@256bit.org>
parents: 12966
diff changeset
461 #define MOUSE_WANT_CLICK 0x01
a62b0bbc8834 patch 8.0.1598: cannot select text in a terminal with the mouse
Christian Brabandt <cb@256bit.org>
parents: 12966
diff changeset
462 #define MOUSE_WANT_DRAG 0x02
a62b0bbc8834 patch 8.0.1598: cannot select text in a terminal with the mouse
Christian Brabandt <cb@256bit.org>
parents: 12966
diff changeset
463 #define MOUSE_WANT_MOVE 0x04
17777
811a12a78164 patch 8.1.1885: comments in libvterm are inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 13770
diff changeset
464 // useful to add protocol?
13448
a62b0bbc8834 patch 8.0.1598: cannot select text in a terminal with the mouse
Christian Brabandt <cb@256bit.org>
parents: 12966
diff changeset
465 } VTermMouseState;
a62b0bbc8834 patch 8.0.1598: cannot select text in a terminal with the mouse
Christian Brabandt <cb@256bit.org>
parents: 12966
diff changeset
466
20496
747a270eb1db patch 8.2.0802: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20488
diff changeset
467 typedef struct {
747a270eb1db patch 8.2.0802: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20488
diff changeset
468 int (*control)(unsigned char control, void *user);
747a270eb1db patch 8.2.0802: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20488
diff changeset
469 int (*csi)(const char *leader, const long args[], int argcount, const char *intermed, char command, void *user);
747a270eb1db patch 8.2.0802: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20488
diff changeset
470 int (*osc)(int command, VTermStringFragment frag, void *user);
747a270eb1db patch 8.2.0802: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20488
diff changeset
471 int (*dcs)(const char *command, size_t commandlen, VTermStringFragment frag, void *user);
26270
f93337ae0612 patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents: 26193
diff changeset
472 int (*apc)(VTermStringFragment frag, void *user);
f93337ae0612 patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents: 26193
diff changeset
473 int (*pm)(VTermStringFragment frag, void *user);
f93337ae0612 patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents: 26193
diff changeset
474 int (*sos)(VTermStringFragment frag, void *user);
20496
747a270eb1db patch 8.2.0802: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20488
diff changeset
475 } VTermStateFallbacks;
747a270eb1db patch 8.2.0802: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20488
diff changeset
476
26270
f93337ae0612 patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents: 26193
diff changeset
477 typedef struct {
f93337ae0612 patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents: 26193
diff changeset
478 int (*set)(VTermSelectionMask mask, VTermStringFragment frag, void *user);
f93337ae0612 patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents: 26193
diff changeset
479 int (*query)(VTermSelectionMask mask, void *user);
f93337ae0612 patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents: 26193
diff changeset
480 } VTermSelectionCallbacks;
f93337ae0612 patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents: 26193
diff changeset
481
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
482 VTermState *vterm_obtain_state(VTerm *vt);
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
483
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
484 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
485 void *vterm_state_get_cbdata(VTermState *state);
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
486
20496
747a270eb1db patch 8.2.0802: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20488
diff changeset
487 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
488 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
489
17777
811a12a78164 patch 8.1.1885: comments in libvterm are inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 13770
diff changeset
490 // Initialize the state.
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
491 void vterm_state_reset(VTermState *state, int hard);
11761
7846efd291d7 patch 8.0.0763: libvterm can be improved
Christian Brabandt <cb@256bit.org>
parents: 11621
diff changeset
492
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
493 void vterm_state_get_cursorpos(const VTermState *state, VTermPos *cursorpos);
30880
82336c3b679d patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents: 30876
diff changeset
494 // VIM: added
13448
a62b0bbc8834 patch 8.0.1598: cannot select text in a terminal with the mouse
Christian Brabandt <cb@256bit.org>
parents: 12966
diff changeset
495 void vterm_state_get_mousestate(const VTermState *state, VTermMouseState *mousestate);
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
496 void vterm_state_get_default_colors(const VTermState *state, VTermColor *default_fg, VTermColor *default_bg);
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
497 void vterm_state_get_palette_color(const VTermState *state, int index, VTermColor *col);
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
498 void vterm_state_set_default_colors(VTermState *state, const VTermColor *default_fg, const VTermColor *default_bg);
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
499 void vterm_state_set_palette_color(VTermState *state, int index, const VTermColor *col);
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
500 void vterm_state_set_bold_highbright(VTermState *state, int bold_is_highbright);
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
501 int vterm_state_get_penattr(const VTermState *state, VTermAttr attr, VTermValue *val);
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
502 int vterm_state_set_termprop(VTermState *state, VTermProp prop, VTermValue *val);
13531
9f857e6310b6 patch 8.0.1639: libvterm code lags behind master
Christian Brabandt <cb@256bit.org>
parents: 13448
diff changeset
503 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
504 void vterm_state_focus_out(VTermState *state);
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
505 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
506
20500
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
507 /**
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
508 * Makes sure that the given color `col` is indeed an RGB colour. After this
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
509 * function returns, VTERM_COLOR_IS_RGB(col) will return true, while all other
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
510 * flags stored in `col->type` will have been reset.
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
511 *
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
512 * @param state is the VTermState instance from which the colour palette should
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
513 * be extracted.
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
514 * @param col is a pointer at the VTermColor instance that should be converted
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
515 * to an RGB colour.
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
516 */
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
517 void vterm_state_convert_color_to_rgb(const VTermState *state, VTermColor *col);
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
518
26270
f93337ae0612 patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents: 26193
diff changeset
519 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: 26193
diff changeset
520 char *buffer, size_t buflen);
f93337ae0612 patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents: 26193
diff changeset
521
f93337ae0612 patch 8.2.3666: libvterm is outdated
Bram Moolenaar <Bram@vim.org>
parents: 26193
diff changeset
522 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: 26193
diff changeset
523
13770
2449b6ce1456 patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents: 13531
diff changeset
524 // ------------
2449b6ce1456 patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents: 13531
diff changeset
525 // Screen layer
2449b6ce1456 patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents: 13531
diff changeset
526 // ------------
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
527
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
528 typedef struct {
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
529 unsigned int bold : 1;
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
530 unsigned int underline : 2;
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
531 unsigned int italic : 1;
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
532 unsigned int blink : 1;
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
533 unsigned int reverse : 1;
20496
747a270eb1db patch 8.2.0802: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20488
diff changeset
534 unsigned int conceal : 1;
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
535 unsigned int strike : 1;
20518
a4652d7ec99f patch 8.2.0813: libvterm code is slightly different from upstream
Bram Moolenaar <Bram@vim.org>
parents: 20500
diff changeset
536 unsigned int font : 4; /* 0 to 9 */
a4652d7ec99f patch 8.2.0813: libvterm code is slightly different from upstream
Bram Moolenaar <Bram@vim.org>
parents: 20500
diff changeset
537 unsigned int dwl : 1; /* On a DECDWL or DECDHL line */
a4652d7ec99f patch 8.2.0813: libvterm code is slightly different from upstream
Bram Moolenaar <Bram@vim.org>
parents: 20500
diff changeset
538 unsigned int dhl : 2; /* On a DECDHL line (1=top 2=bottom) */
30894
bf4f25d50fdd patch 9.0.0781: workaround to rename "small" to "smallfont" is clumsy
Bram Moolenaar <Bram@vim.org>
parents: 30884
diff changeset
539 unsigned int small : 1;
30880
82336c3b679d patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents: 30876
diff changeset
540 unsigned int baseline : 2;
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
541 } VTermScreenCellAttrs;
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
542
20462
9ad473b50471 patch 8.2.0785: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20460
diff changeset
543 enum {
9ad473b50471 patch 8.2.0785: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20460
diff changeset
544 VTERM_UNDERLINE_OFF,
9ad473b50471 patch 8.2.0785: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20460
diff changeset
545 VTERM_UNDERLINE_SINGLE,
9ad473b50471 patch 8.2.0785: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20460
diff changeset
546 VTERM_UNDERLINE_DOUBLE,
9ad473b50471 patch 8.2.0785: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20460
diff changeset
547 VTERM_UNDERLINE_CURLY,
9ad473b50471 patch 8.2.0785: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20460
diff changeset
548 };
9ad473b50471 patch 8.2.0785: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20460
diff changeset
549
30880
82336c3b679d patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents: 30876
diff changeset
550 enum {
82336c3b679d patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents: 30876
diff changeset
551 VTERM_BASELINE_NORMAL,
82336c3b679d patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents: 30876
diff changeset
552 VTERM_BASELINE_RAISE,
82336c3b679d patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents: 30876
diff changeset
553 VTERM_BASELINE_LOWER,
82336c3b679d patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents: 30876
diff changeset
554 };
82336c3b679d patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents: 30876
diff changeset
555
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
556 typedef struct {
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
557 uint32_t chars[VTERM_MAX_CHARS_PER_CELL];
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
558 char width;
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
559 VTermScreenCellAttrs attrs;
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
560 VTermColor fg, bg;
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
561 } VTermScreenCell;
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
562
17777
811a12a78164 patch 8.1.1885: comments in libvterm are inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 13770
diff changeset
563 // All fields are optional, NULL when not used.
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
564 typedef struct {
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
565 int (*damage)(VTermRect rect, void *user);
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
566 int (*moverect)(VTermRect dest, VTermRect src, void *user);
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
567 int (*movecursor)(VTermPos pos, VTermPos oldpos, int visible, void *user);
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
568 int (*settermprop)(VTermProp prop, VTermValue *val, void *user);
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
569 int (*bell)(void *user);
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
570 int (*resize)(int rows, int cols, void *user);
17777
811a12a78164 patch 8.1.1885: comments in libvterm are inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 13770
diff changeset
571 // A line was pushed off the top of the window.
811a12a78164 patch 8.1.1885: comments in libvterm are inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 13770
diff changeset
572 // "cells[cols]" contains the cells of that line.
811a12a78164 patch 8.1.1885: comments in libvterm are inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 13770
diff changeset
573 // Return value is unused.
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
574 int (*sb_pushline)(int cols, const VTermScreenCell *cells, void *user);
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
575 int (*sb_popline)(int cols, VTermScreenCell *cells, void *user);
30880
82336c3b679d patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents: 30876
diff changeset
576 int (*sb_clear)(void* user);
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
577 } VTermScreenCallbacks;
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
578
17777
811a12a78164 patch 8.1.1885: comments in libvterm are inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 13770
diff changeset
579 // Return the screen of the vterm.
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
580 VTermScreen *vterm_obtain_screen(VTerm *vt);
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
581
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
582 /*
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
583 * Install screen callbacks. These are invoked when the screen contents is
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
584 * changed. "user" is passed into to the callback.
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
585 */
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
586 void vterm_screen_set_callbacks(VTermScreen *screen, const VTermScreenCallbacks *callbacks, void *user);
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
587 void *vterm_screen_get_cbdata(VTermScreen *screen);
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
588
20496
747a270eb1db patch 8.2.0802: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20488
diff changeset
589 void vterm_screen_set_unrecognised_fallbacks(VTermScreen *screen, const VTermStateFallbacks *fallbacks, void *user);
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
590 void *vterm_screen_get_unrecognised_fbdata(VTermScreen *screen);
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
591
30880
82336c3b679d patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents: 30876
diff changeset
592 void vterm_screen_enable_reflow(VTermScreen *screen, int reflow);
82336c3b679d patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents: 30876
diff changeset
593
82336c3b679d patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents: 30876
diff changeset
594 // Back-compat alias for the brief time it was in 0.3-RC1
82336c3b679d patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents: 30876
diff changeset
595 #define vterm_screen_set_reflow vterm_screen_enable_reflow
82336c3b679d patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents: 30876
diff changeset
596
17777
811a12a78164 patch 8.1.1885: comments in libvterm are inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 13770
diff changeset
597 // Enable support for using the alternate screen if "altscreen" is non-zero.
811a12a78164 patch 8.1.1885: comments in libvterm are inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 13770
diff changeset
598 // Before that switching to the alternate screen won't work.
811a12a78164 patch 8.1.1885: comments in libvterm are inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 13770
diff changeset
599 // Calling with "altscreen" zero has no effect.
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
600 void vterm_screen_enable_altscreen(VTermScreen *screen, int altscreen);
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 typedef enum {
20518
a4652d7ec99f patch 8.2.0813: libvterm code is slightly different from upstream
Bram Moolenaar <Bram@vim.org>
parents: 20500
diff changeset
603 VTERM_DAMAGE_CELL, /* every cell */
a4652d7ec99f patch 8.2.0813: libvterm code is slightly different from upstream
Bram Moolenaar <Bram@vim.org>
parents: 20500
diff changeset
604 VTERM_DAMAGE_ROW, /* entire rows */
a4652d7ec99f patch 8.2.0813: libvterm code is slightly different from upstream
Bram Moolenaar <Bram@vim.org>
parents: 20500
diff changeset
605 VTERM_DAMAGE_SCREEN, /* entire screen */
a4652d7ec99f patch 8.2.0813: libvterm code is slightly different from upstream
Bram Moolenaar <Bram@vim.org>
parents: 20500
diff changeset
606 VTERM_DAMAGE_SCROLL, /* entire screen + scrollrect */
13531
9f857e6310b6 patch 8.0.1639: libvterm code lags behind master
Christian Brabandt <cb@256bit.org>
parents: 13448
diff changeset
607
9f857e6310b6 patch 8.0.1639: libvterm code lags behind master
Christian Brabandt <cb@256bit.org>
parents: 13448
diff changeset
608 VTERM_N_DAMAGES
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
609 } VTermDamageSize;
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
610
17777
811a12a78164 patch 8.1.1885: comments in libvterm are inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 13770
diff changeset
611 // Invoke the relevant callbacks to update the screen.
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
612 void vterm_screen_flush_damage(VTermScreen *screen);
11761
7846efd291d7 patch 8.0.0763: libvterm can be improved
Christian Brabandt <cb@256bit.org>
parents: 11621
diff changeset
613
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
614 void vterm_screen_set_damage_merge(VTermScreen *screen, VTermDamageSize size);
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
615
11761
7846efd291d7 patch 8.0.0763: libvterm can be improved
Christian Brabandt <cb@256bit.org>
parents: 11621
diff changeset
616 /*
7846efd291d7 patch 8.0.0763: libvterm can be improved
Christian Brabandt <cb@256bit.org>
parents: 11621
diff changeset
617 * Reset the screen. Also invokes vterm_state_reset().
7846efd291d7 patch 8.0.0763: libvterm can be improved
Christian Brabandt <cb@256bit.org>
parents: 11621
diff changeset
618 * Must be called before the terminal can be used.
7846efd291d7 patch 8.0.0763: libvterm can be improved
Christian Brabandt <cb@256bit.org>
parents: 11621
diff changeset
619 */
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
620 void vterm_screen_reset(VTermScreen *screen, int hard);
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
621
20518
a4652d7ec99f patch 8.2.0813: libvterm code is slightly different from upstream
Bram Moolenaar <Bram@vim.org>
parents: 20500
diff changeset
622 /* Neither of these functions NUL-terminate the buffer */
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
623 size_t vterm_screen_get_chars(const VTermScreen *screen, uint32_t *chars, size_t len, const VTermRect rect);
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
624 size_t vterm_screen_get_text(const VTermScreen *screen, char *str, size_t len, const VTermRect rect);
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
625
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
626 typedef enum {
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
627 VTERM_ATTR_BOLD_MASK = 1 << 0,
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
628 VTERM_ATTR_UNDERLINE_MASK = 1 << 1,
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
629 VTERM_ATTR_ITALIC_MASK = 1 << 2,
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
630 VTERM_ATTR_BLINK_MASK = 1 << 3,
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
631 VTERM_ATTR_REVERSE_MASK = 1 << 4,
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
632 VTERM_ATTR_STRIKE_MASK = 1 << 5,
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
633 VTERM_ATTR_FONT_MASK = 1 << 6,
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
634 VTERM_ATTR_FOREGROUND_MASK = 1 << 7,
13531
9f857e6310b6 patch 8.0.1639: libvterm code lags behind master
Christian Brabandt <cb@256bit.org>
parents: 13448
diff changeset
635 VTERM_ATTR_BACKGROUND_MASK = 1 << 8,
20496
747a270eb1db patch 8.2.0802: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20488
diff changeset
636 VTERM_ATTR_CONCEAL_MASK = 1 << 9,
30880
82336c3b679d patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents: 30876
diff changeset
637 VTERM_ATTR_SMALL_MASK = 1 << 10,
82336c3b679d patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents: 30876
diff changeset
638 VTERM_ATTR_BASELINE_MASK = 1 << 11,
13531
9f857e6310b6 patch 8.0.1639: libvterm code lags behind master
Christian Brabandt <cb@256bit.org>
parents: 13448
diff changeset
639
30880
82336c3b679d patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents: 30876
diff changeset
640 VTERM_ALL_ATTRS_MASK = (1 << 12) - 1
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
641 } VTermAttrMask;
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
642
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
643 int vterm_screen_get_attrs_extent(const VTermScreen *screen, VTermRect *extent, VTermPos pos, VTermAttrMask attrs);
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
644
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
645 int vterm_screen_get_cell(const VTermScreen *screen, VTermPos pos, VTermScreenCell *cell);
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
646
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
647 int vterm_screen_is_eol(const VTermScreen *screen, VTermPos pos);
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
648
20500
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
649 /**
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
650 * Same as vterm_state_convert_color_to_rgb(), but takes a `screen` instead of a `state`
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
651 * instance.
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
652 */
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
653 void vterm_screen_convert_color_to_rgb(const VTermScreen *screen, VTermColor *col);
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
654
32728
b13f723a7ec6 patch 9.0.1684: Update libvterm to rev 839
Christian Brabandt <cb@256bit.org>
parents: 31192
diff changeset
655 /**
b13f723a7ec6 patch 9.0.1684: Update libvterm to rev 839
Christian Brabandt <cb@256bit.org>
parents: 31192
diff changeset
656 * Similar to vterm_state_set_default_colors(), but also resets colours in the
b13f723a7ec6 patch 9.0.1684: Update libvterm to rev 839
Christian Brabandt <cb@256bit.org>
parents: 31192
diff changeset
657 * screen buffer(s)
b13f723a7ec6 patch 9.0.1684: Update libvterm to rev 839
Christian Brabandt <cb@256bit.org>
parents: 31192
diff changeset
658 */
b13f723a7ec6 patch 9.0.1684: Update libvterm to rev 839
Christian Brabandt <cb@256bit.org>
parents: 31192
diff changeset
659 void vterm_screen_set_default_colors(VTermScreen *screen, const VTermColor *default_fg, const VTermColor *default_bg);
b13f723a7ec6 patch 9.0.1684: Update libvterm to rev 839
Christian Brabandt <cb@256bit.org>
parents: 31192
diff changeset
660
13770
2449b6ce1456 patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents: 13531
diff changeset
661 // ---------
2449b6ce1456 patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents: 13531
diff changeset
662 // Utilities
2449b6ce1456 patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents: 13531
diff changeset
663 // ---------
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
664
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
665 VTermValueType vterm_get_attr_type(VTermAttr attr);
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
666 VTermValueType vterm_get_prop_type(VTermProp prop);
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
667
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
668 void vterm_scroll_rect(VTermRect rect,
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
669 int downward,
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
670 int rightward,
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
671 int (*moverect)(VTermRect src, VTermRect dest, void *user),
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
672 int (*eraserect)(VTermRect rect, int selective, void *user),
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
673 void *user);
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
674
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
675 void vterm_copy_cells(VTermRect dest,
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
676 VTermRect src,
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
677 void (*copycell)(VTermPos dest, VTermPos src, void *user),
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
678 void *user);
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
679
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
680 #ifdef __cplusplus
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 #endif
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
683
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
684 #endif