annotate src/libvterm/include/vterm.h @ 20518:a4652d7ec99f v8.2.0813

patch 8.2.0813: libvterm code is slightly different from upstream Commit: https://github.com/vim/vim/commit/591cec8366e87a172495c362477cbf5de8d399f0 Author: Bram Moolenaar <Bram@vim.org> Date: Fri May 22 22:06:06 2020 +0200 patch 8.2.0813: libvterm code is slightly different from upstream Problem: libvterm code is slightly different from upstream. Solution: Use upstream text to avoid future merge problems. Mainly comment style changes.
author Bram Moolenaar <Bram@vim.org>
date Fri, 22 May 2020 22:15:04 +0200
parents 03826c672315
children c83460a14407
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
11780
c76b672df584 patch 8.0.0772: other stdbool.h dependencies in libvterm
Christian Brabandt <cb@256bit.org>
parents: 11761
diff changeset
15 #define TRUE 1
c76b672df584 patch 8.0.0772: other stdbool.h dependencies in libvterm
Christian Brabandt <cb@256bit.org>
parents: 11761
diff changeset
16 #define FALSE 0
c76b672df584 patch 8.0.0772: other stdbool.h dependencies in libvterm
Christian Brabandt <cb@256bit.org>
parents: 11761
diff changeset
17
17777
811a12a78164 patch 8.1.1885: comments in libvterm are inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 13770
diff changeset
18 // 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
19 typedef unsigned char uint8_t;
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 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
21
20462
9ad473b50471 patch 8.2.0785: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20460
diff changeset
22 #define VTERM_VERSION_MAJOR 0
9ad473b50471 patch 8.2.0785: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20460
diff changeset
23 #define VTERM_VERSION_MINOR 1
9ad473b50471 patch 8.2.0785: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20460
diff changeset
24
9ad473b50471 patch 8.2.0785: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20460
diff changeset
25 #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
26 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
27
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
28 typedef struct VTerm VTerm;
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
29 typedef struct VTermState VTermState;
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30 typedef struct VTermScreen VTermScreen;
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
31
17777
811a12a78164 patch 8.1.1885: comments in libvterm are inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 13770
diff changeset
32 // Specifies a screen point.
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
33 typedef struct {
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
34 int row;
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
35 int col;
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
36 } VTermPos;
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
37
20518
a4652d7ec99f patch 8.2.0813: libvterm code is slightly different from upstream
Bram Moolenaar <Bram@vim.org>
parents: 20500
diff changeset
38 /* 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
39
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
40 /*
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
41 * Order points by on-screen flow order:
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
42 * Return < 0 if "a" is before "b"
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
43 * 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
44 * Return > 0 if "a" is after "b".
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
45 */
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
46 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
47
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
48 #if defined(DEFINE_INLINES) || USE_INLINE
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
49 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
50 {
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
51 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
52 }
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
53 #endif
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
54
17777
811a12a78164 patch 8.1.1885: comments in libvterm are inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 13770
diff changeset
55 // Specifies a rectangular screen area.
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
56 typedef struct {
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
57 int start_row;
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
58 int end_row;
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
59 int start_col;
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
60 int end_col;
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
61 } VTermRect;
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
62
20518
a4652d7ec99f patch 8.2.0813: libvterm code is slightly different from upstream
Bram Moolenaar <Bram@vim.org>
parents: 20500
diff changeset
63 /* 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
64 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
65
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
66 #if defined(DEFINE_INLINES) || USE_INLINE
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
67 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
68 {
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
69 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
70 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
71 }
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
72 #endif
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
73
20518
a4652d7ec99f patch 8.2.0813: libvterm code is slightly different from upstream
Bram Moolenaar <Bram@vim.org>
parents: 20500
diff changeset
74 /* move a rect */
17777
811a12a78164 patch 8.1.1885: comments in libvterm are inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 13770
diff changeset
75 // 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
76 // Does not check boundaries.
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
77 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
78
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
79 #if defined(DEFINE_INLINES) || USE_INLINE
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
80 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
81 {
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
82 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
83 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
84 }
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
85 #endif
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
86
20500
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
87 /**
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
88 * 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
89 */
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
90 typedef enum {
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
91 /**
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
92 * 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
93 */
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
94 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
95
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
96 /**
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
97 * 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
98 */
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
99 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
100
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 * 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
103 */
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
104 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
105
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 * 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
108 * 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
109 * 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
110 * 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
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_DEFAULT_FG = 0x02,
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 background
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. A common
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
117 * 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
118 * 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
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_BG = 0x04,
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 * 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
124 */
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
125 VTERM_COLOR_DEFAULT_MASK = 0x06
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
126 } VTermColorType;
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 /**
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
129 * 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
130 * 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
131 */
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
132 #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
133 (((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
134
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
135 /**
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
136 * 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
137 * 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
138 */
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
139 #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
140 (((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
141
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
142 /**
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
143 * 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
144 * 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
145 * color.
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
146 */
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
147 #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
148 (!!((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
149
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
150 /**
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
151 * 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
152 * 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
153 * color.
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 #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
156 (!!((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
157
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
158 typedef struct {
20500
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 * 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
161 * 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
162 * 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
163 */
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
164 uint8_t type;
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
165
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
166 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
167
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
168 uint8_t index;
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
169 } VTermColor;
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
170
20500
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
171 /**
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
172 * 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
173 */
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
174 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
175
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
176 /**
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
177 * 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
178 * given index.
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 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
181
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
182 /**
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
183 * 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
184 */
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
185 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
186
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
187 typedef enum {
20518
a4652d7ec99f patch 8.2.0813: libvterm code is slightly different from upstream
Bram Moolenaar <Bram@vim.org>
parents: 20500
diff changeset
188 /* VTERM_VALUETYPE_NONE = 0 */
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
189 VTERM_VALUETYPE_BOOL = 1,
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
190 VTERM_VALUETYPE_INT,
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
191 VTERM_VALUETYPE_STRING,
13531
9f857e6310b6 patch 8.0.1639: libvterm code lags behind master
Christian Brabandt <cb@256bit.org>
parents: 13448
diff changeset
192 VTERM_VALUETYPE_COLOR,
9f857e6310b6 patch 8.0.1639: libvterm code lags behind master
Christian Brabandt <cb@256bit.org>
parents: 13448
diff changeset
193
9f857e6310b6 patch 8.0.1639: libvterm code lags behind master
Christian Brabandt <cb@256bit.org>
parents: 13448
diff changeset
194 VTERM_N_VALUETYPES
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
195 } VTermValueType;
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
196
20488
1d595fada804 patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20482
diff changeset
197 typedef struct {
1d595fada804 patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20482
diff changeset
198 const char *str;
1d595fada804 patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20482
diff changeset
199 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
200 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
201 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
202 } VTermStringFragment;
1d595fada804 patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20482
diff changeset
203
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
204 typedef union {
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
205 int boolean;
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
206 int number;
20488
1d595fada804 patch 8.2.0798: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20482
diff changeset
207 VTermStringFragment string;
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
208 VTermColor color;
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
209 } VTermValue;
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
210
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
211 typedef enum {
20518
a4652d7ec99f patch 8.2.0813: libvterm code is slightly different from upstream
Bram Moolenaar <Bram@vim.org>
parents: 20500
diff changeset
212 /* VTERM_ATTR_NONE = 0 */
13770
2449b6ce1456 patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents: 13531
diff changeset
213 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
214 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
215 VTERM_ATTR_ITALIC, // bool: 3, 23
2449b6ce1456 patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents: 13531
diff changeset
216 VTERM_ATTR_BLINK, // bool: 5, 25
2449b6ce1456 patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents: 13531
diff changeset
217 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
218 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
219 VTERM_ATTR_STRIKE, // bool: 9, 29
2449b6ce1456 patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents: 13531
diff changeset
220 VTERM_ATTR_FONT, // number: 10-19
2449b6ce1456 patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents: 13531
diff changeset
221 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
222 VTERM_ATTR_BACKGROUND, // color: 40-49 100-107
13531
9f857e6310b6 patch 8.0.1639: libvterm code lags behind master
Christian Brabandt <cb@256bit.org>
parents: 13448
diff changeset
223
9f857e6310b6 patch 8.0.1639: libvterm code lags behind master
Christian Brabandt <cb@256bit.org>
parents: 13448
diff changeset
224 VTERM_N_ATTRS
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
225 } VTermAttr;
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
226
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
227 typedef enum {
20518
a4652d7ec99f patch 8.2.0813: libvterm code is slightly different from upstream
Bram Moolenaar <Bram@vim.org>
parents: 20500
diff changeset
228 /* VTERM_PROP_NONE = 0 */
13770
2449b6ce1456 patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents: 13531
diff changeset
229 VTERM_PROP_CURSORVISIBLE = 1, // bool
2449b6ce1456 patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents: 13531
diff changeset
230 VTERM_PROP_CURSORBLINK, // bool
2449b6ce1456 patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents: 13531
diff changeset
231 VTERM_PROP_ALTSCREEN, // bool
2449b6ce1456 patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents: 13531
diff changeset
232 VTERM_PROP_TITLE, // string
2449b6ce1456 patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents: 13531
diff changeset
233 VTERM_PROP_ICONNAME, // string
2449b6ce1456 patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents: 13531
diff changeset
234 VTERM_PROP_REVERSE, // bool
2449b6ce1456 patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents: 13531
diff changeset
235 VTERM_PROP_CURSORSHAPE, // number
2449b6ce1456 patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents: 13531
diff changeset
236 VTERM_PROP_MOUSE, // number
2449b6ce1456 patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents: 13531
diff changeset
237 VTERM_PROP_CURSORCOLOR, // string
13531
9f857e6310b6 patch 8.0.1639: libvterm code lags behind master
Christian Brabandt <cb@256bit.org>
parents: 13448
diff changeset
238
9f857e6310b6 patch 8.0.1639: libvterm code lags behind master
Christian Brabandt <cb@256bit.org>
parents: 13448
diff changeset
239 VTERM_N_PROPS
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
240 } VTermProp;
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
241
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
242 enum {
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
243 VTERM_PROP_CURSORSHAPE_BLOCK = 1,
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
244 VTERM_PROP_CURSORSHAPE_UNDERLINE,
13531
9f857e6310b6 patch 8.0.1639: libvterm code lags behind master
Christian Brabandt <cb@256bit.org>
parents: 13448
diff changeset
245 VTERM_PROP_CURSORSHAPE_BAR_LEFT,
9f857e6310b6 patch 8.0.1639: libvterm code lags behind master
Christian Brabandt <cb@256bit.org>
parents: 13448
diff changeset
246
9f857e6310b6 patch 8.0.1639: libvterm code lags behind master
Christian Brabandt <cb@256bit.org>
parents: 13448
diff changeset
247 VTERM_N_PROP_CURSORSHAPES
11621
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
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
250 enum {
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
251 VTERM_PROP_MOUSE_NONE = 0,
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
252 VTERM_PROP_MOUSE_CLICK,
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
253 VTERM_PROP_MOUSE_DRAG,
13531
9f857e6310b6 patch 8.0.1639: libvterm code lags behind master
Christian Brabandt <cb@256bit.org>
parents: 13448
diff changeset
254 VTERM_PROP_MOUSE_MOVE,
9f857e6310b6 patch 8.0.1639: libvterm code lags behind master
Christian Brabandt <cb@256bit.org>
parents: 13448
diff changeset
255
9f857e6310b6 patch 8.0.1639: libvterm code lags behind master
Christian Brabandt <cb@256bit.org>
parents: 13448
diff changeset
256 VTERM_N_PROP_MOUSES
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
257 };
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
258
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
259 typedef struct {
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
260 const uint32_t *chars;
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
261 int width;
20518
a4652d7ec99f patch 8.2.0813: libvterm code is slightly different from upstream
Bram Moolenaar <Bram@vim.org>
parents: 20500
diff changeset
262 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
263 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
264 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
265 } VTermGlyphInfo;
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
266
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
267 typedef struct {
20482
dc88c690f19b patch 8.2.0795: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20480
diff changeset
268 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
269 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
270 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
271 } VTermLineInfo;
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
272
20518
a4652d7ec99f patch 8.2.0813: libvterm code is slightly different from upstream
Bram Moolenaar <Bram@vim.org>
parents: 20500
diff changeset
273 /* 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
274 * 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
275 * 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
276 * 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
277 */
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
278 typedef struct {
20518
a4652d7ec99f patch 8.2.0813: libvterm code is slightly different from upstream
Bram Moolenaar <Bram@vim.org>
parents: 20500
diff changeset
279 VTermPos pos; /* current cursor position */
a4652d7ec99f patch 8.2.0813: libvterm code is slightly different from upstream
Bram Moolenaar <Bram@vim.org>
parents: 20500
diff changeset
280 } VTermStateFields;
a4652d7ec99f patch 8.2.0813: libvterm code is slightly different from upstream
Bram Moolenaar <Bram@vim.org>
parents: 20500
diff changeset
281
a4652d7ec99f patch 8.2.0813: libvterm code is slightly different from upstream
Bram Moolenaar <Bram@vim.org>
parents: 20500
diff changeset
282 typedef struct {
a4652d7ec99f patch 8.2.0813: libvterm code is slightly different from upstream
Bram Moolenaar <Bram@vim.org>
parents: 20500
diff changeset
283 /* 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
284 * by the allocator. */
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
285 void *(*malloc)(size_t size, void *allocdata);
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
286 void (*free)(void *ptr, void *allocdata);
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
287 } VTermAllocatorFunctions;
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
288
20462
9ad473b50471 patch 8.2.0785: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20460
diff changeset
289 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
290
17777
811a12a78164 patch 8.1.1885: comments in libvterm are inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 13770
diff changeset
291 // 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
292 VTerm *vterm_new(int rows, int cols);
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
293
17777
811a12a78164 patch 8.1.1885: comments in libvterm are inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 13770
diff changeset
294 // 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
295 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
296
17777
811a12a78164 patch 8.1.1885: comments in libvterm are inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 13770
diff changeset
297 // 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
298 void vterm_free(VTerm* vt);
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
299
17777
811a12a78164 patch 8.1.1885: comments in libvterm are inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 13770
diff changeset
300 // 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
301 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
302
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
303 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
304
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
305 int vterm_get_utf8(const VTerm *vt);
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
306 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
307
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
308 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
309
20460
c15dd3da4f47 patch 8.2.0784: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 18802
diff changeset
310 /* 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
311 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
312 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
313
c15dd3da4f47 patch 8.2.0784: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 18802
diff changeset
314 /* 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
315 * 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
316 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
317 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
318 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
319
20460
c15dd3da4f47 patch 8.2.0784: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 18802
diff changeset
320 /* This too */
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
321 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
322
18279
e8d1f3209dcd patch 8.1.2134: modifier keys are not always recognized
Bram Moolenaar <Bram@vim.org>
parents: 17777
diff changeset
323 int vterm_is_modify_other_keys(VTerm *vt);
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
324 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
325 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
326
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
327 void vterm_keyboard_start_paste(VTerm *vt);
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
328 void vterm_keyboard_end_paste(VTerm *vt);
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
329
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
330 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
331 // "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
332 // 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
333 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
334
13770
2449b6ce1456 patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents: 13531
diff changeset
335 // ------------
2449b6ce1456 patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents: 13531
diff changeset
336 // Parser layer
2449b6ce1456 patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents: 13531
diff changeset
337 // ------------
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
338
20518
a4652d7ec99f patch 8.2.0813: libvterm code is slightly different from upstream
Bram Moolenaar <Bram@vim.org>
parents: 20500
diff changeset
339 /* 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
340 * Consider
a4652d7ec99f patch 8.2.0813: libvterm code is slightly different from upstream
Bram Moolenaar <Bram@vim.org>
parents: 20500
diff changeset
341 * 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
342 * 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
343 * 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
344 *
a4652d7ec99f patch 8.2.0813: libvterm code is slightly different from upstream
Bram Moolenaar <Bram@vim.org>
parents: 20500
diff changeset
345 * 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
346 */
13531
9f857e6310b6 patch 8.0.1639: libvterm code lags behind master
Christian Brabandt <cb@256bit.org>
parents: 13448
diff changeset
347 #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
348 #define CSI_ARG_MASK (~(1U<<31))
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
349
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
350 #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
351 #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
352
20518
a4652d7ec99f patch 8.2.0813: libvterm code is slightly different from upstream
Bram Moolenaar <Bram@vim.org>
parents: 20500
diff changeset
353 /* Can't use -1 to indicate a missing argument; use this instead */
11761
7846efd291d7 patch 8.0.0763: libvterm can be improved
Christian Brabandt <cb@256bit.org>
parents: 11621
diff changeset
354 #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
355
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
356 #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
357 #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
358 #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
359
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
360 typedef struct {
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
361 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
362 int (*control)(unsigned char control, void *user);
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
363 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
364 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
365 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
366 int (*dcs)(const char *command, size_t commandlen, VTermStringFragment frag, void *user);
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
367 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
368 } VTermParserCallbacks;
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
369
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
370 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
371 void *vterm_parser_get_cbdata(VTerm *vt);
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
372
13770
2449b6ce1456 patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents: 13531
diff changeset
373 // -----------
2449b6ce1456 patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents: 13531
diff changeset
374 // State layer
2449b6ce1456 patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents: 13531
diff changeset
375 // -----------
11621
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 typedef struct {
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
378 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
379 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
380 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
381 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
382 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
383 int (*initpen)(void *user);
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
384 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
385 // 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
386 // was accepted, 0 otherwise.
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
387 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
388 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
389 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
390 int (*setlineinfo)(int row, const VTermLineInfo *newinfo, const VTermLineInfo *oldinfo, void *user);
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
391 } VTermStateCallbacks;
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
392
13448
a62b0bbc8834 patch 8.0.1598: cannot select text in a terminal with the mouse
Christian Brabandt <cb@256bit.org>
parents: 12966
diff changeset
393 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
394 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
395 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
396 #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
397 #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
398 #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
399 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
400 #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
401 #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
402 #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
403 // 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
404 } VTermMouseState;
a62b0bbc8834 patch 8.0.1598: cannot select text in a terminal with the mouse
Christian Brabandt <cb@256bit.org>
parents: 12966
diff changeset
405
20496
747a270eb1db patch 8.2.0802: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20488
diff changeset
406 typedef struct {
747a270eb1db patch 8.2.0802: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20488
diff changeset
407 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
408 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
409 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
410 int (*dcs)(const char *command, size_t commandlen, 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
411 } VTermStateFallbacks;
747a270eb1db patch 8.2.0802: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20488
diff changeset
412
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
413 VTermState *vterm_obtain_state(VTerm *vt);
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
414
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
415 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
416 void *vterm_state_get_cbdata(VTermState *state);
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
417
20496
747a270eb1db patch 8.2.0802: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20488
diff changeset
418 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
419 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
420
17777
811a12a78164 patch 8.1.1885: comments in libvterm are inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 13770
diff changeset
421 // Initialize the state.
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
422 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
423
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
424 void vterm_state_get_cursorpos(const VTermState *state, VTermPos *cursorpos);
13448
a62b0bbc8834 patch 8.0.1598: cannot select text in a terminal with the mouse
Christian Brabandt <cb@256bit.org>
parents: 12966
diff changeset
425 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
426 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
427 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
428 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
429 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
430 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
431 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
432 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
433 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
434 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
435 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
436
20500
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
437 /**
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
438 * 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
439 * 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
440 * 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
441 *
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
442 * @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
443 * be extracted.
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
444 * @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
445 * 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
446 */
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
447 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
448
13770
2449b6ce1456 patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents: 13531
diff changeset
449 // ------------
2449b6ce1456 patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents: 13531
diff changeset
450 // Screen layer
2449b6ce1456 patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents: 13531
diff changeset
451 // ------------
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
452
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
453 typedef struct {
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
454 unsigned int bold : 1;
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
455 unsigned int underline : 2;
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
456 unsigned int italic : 1;
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
457 unsigned int blink : 1;
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
458 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
459 unsigned int conceal : 1;
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
460 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
461 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
462 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
463 unsigned int dhl : 2; /* On a DECDHL line (1=top 2=bottom) */
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
464 } VTermScreenCellAttrs;
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
465
20462
9ad473b50471 patch 8.2.0785: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20460
diff changeset
466 enum {
9ad473b50471 patch 8.2.0785: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20460
diff changeset
467 VTERM_UNDERLINE_OFF,
9ad473b50471 patch 8.2.0785: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20460
diff changeset
468 VTERM_UNDERLINE_SINGLE,
9ad473b50471 patch 8.2.0785: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20460
diff changeset
469 VTERM_UNDERLINE_DOUBLE,
9ad473b50471 patch 8.2.0785: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20460
diff changeset
470 VTERM_UNDERLINE_CURLY,
9ad473b50471 patch 8.2.0785: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20460
diff changeset
471 };
9ad473b50471 patch 8.2.0785: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20460
diff changeset
472
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
473 typedef struct {
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
474 #define VTERM_MAX_CHARS_PER_CELL 6
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
475 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
476 char width;
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
477 VTermScreenCellAttrs attrs;
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
478 VTermColor fg, bg;
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
479 } VTermScreenCell;
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
480
17777
811a12a78164 patch 8.1.1885: comments in libvterm are inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 13770
diff changeset
481 // 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
482 typedef struct {
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
483 int (*damage)(VTermRect rect, void *user);
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
484 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
485 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
486 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
487 int (*bell)(void *user);
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
488 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
489 // 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
490 // "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
491 // Return value is unused.
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
492 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
493 int (*sb_popline)(int cols, VTermScreenCell *cells, void *user);
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
494 } VTermScreenCallbacks;
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
495
17777
811a12a78164 patch 8.1.1885: comments in libvterm are inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 13770
diff changeset
496 // Return the screen of the vterm.
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
497 VTermScreen *vterm_obtain_screen(VTerm *vt);
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
498
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
499 /*
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
500 * 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
501 * 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
502 */
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
503 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
504 void *vterm_screen_get_cbdata(VTermScreen *screen);
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
505
20496
747a270eb1db patch 8.2.0802: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20488
diff changeset
506 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
507 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
508
17777
811a12a78164 patch 8.1.1885: comments in libvterm are inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 13770
diff changeset
509 // 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
510 // 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
511 // 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
512 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
513
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
514 typedef enum {
20518
a4652d7ec99f patch 8.2.0813: libvterm code is slightly different from upstream
Bram Moolenaar <Bram@vim.org>
parents: 20500
diff changeset
515 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
516 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
517 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
518 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
519
9f857e6310b6 patch 8.0.1639: libvterm code lags behind master
Christian Brabandt <cb@256bit.org>
parents: 13448
diff changeset
520 VTERM_N_DAMAGES
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
521 } VTermDamageSize;
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
522
17777
811a12a78164 patch 8.1.1885: comments in libvterm are inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 13770
diff changeset
523 // 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
524 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
525
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
526 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
527
11761
7846efd291d7 patch 8.0.0763: libvterm can be improved
Christian Brabandt <cb@256bit.org>
parents: 11621
diff changeset
528 /*
7846efd291d7 patch 8.0.0763: libvterm can be improved
Christian Brabandt <cb@256bit.org>
parents: 11621
diff changeset
529 * 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
530 * 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
531 */
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
532 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
533
20518
a4652d7ec99f patch 8.2.0813: libvterm code is slightly different from upstream
Bram Moolenaar <Bram@vim.org>
parents: 20500
diff changeset
534 /* 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
535 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
536 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
537
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
538 typedef enum {
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
539 VTERM_ATTR_BOLD_MASK = 1 << 0,
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
540 VTERM_ATTR_UNDERLINE_MASK = 1 << 1,
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
541 VTERM_ATTR_ITALIC_MASK = 1 << 2,
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
542 VTERM_ATTR_BLINK_MASK = 1 << 3,
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
543 VTERM_ATTR_REVERSE_MASK = 1 << 4,
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
544 VTERM_ATTR_STRIKE_MASK = 1 << 5,
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
545 VTERM_ATTR_FONT_MASK = 1 << 6,
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
546 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
547 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
548 VTERM_ATTR_CONCEAL_MASK = 1 << 9,
13531
9f857e6310b6 patch 8.0.1639: libvterm code lags behind master
Christian Brabandt <cb@256bit.org>
parents: 13448
diff changeset
549
20496
747a270eb1db patch 8.2.0802: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20488
diff changeset
550 VTERM_ALL_ATTRS_MASK = (1 << 10) - 1
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
551 } VTermAttrMask;
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
552
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
553 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
554
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
555 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
556
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
557 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
558
20500
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
559 /**
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
560 * 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
561 * instance.
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
562 */
03826c672315 patch 8.2.0804: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents: 20496
diff changeset
563 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
564
13770
2449b6ce1456 patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents: 13531
diff changeset
565 // ---------
2449b6ce1456 patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents: 13531
diff changeset
566 // Utilities
2449b6ce1456 patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents: 13531
diff changeset
567 // ---------
11621
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
568
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
569 VTermValueType vterm_get_attr_type(VTermAttr attr);
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
570 VTermValueType vterm_get_prop_type(VTermProp prop);
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
571
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
572 void vterm_scroll_rect(VTermRect rect,
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
573 int downward,
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
574 int rightward,
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
575 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
576 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
577 void *user);
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
578
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
579 void vterm_copy_cells(VTermRect dest,
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
580 VTermRect src,
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
581 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
582 void *user);
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
583
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
584 #ifdef __cplusplus
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 #endif
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
587
b8299e742f41 patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
588 #endif