Bram Moolenaar | e4f25e4 | 2017-07-07 11:54:15 +0200 | [diff] [blame] | 1 | /* |
| 2 | * NOTE: This is a MODIFIED version of libvterm, see the README file. |
| 3 | */ |
| 4 | #ifndef __VTERM_H__ |
| 5 | #define __VTERM_H__ |
| 6 | |
| 7 | #ifdef __cplusplus |
| 8 | extern "C" { |
| 9 | #endif |
| 10 | |
Bram Moolenaar | e4f25e4 | 2017-07-07 11:54:15 +0200 | [diff] [blame] | 11 | #include <stdlib.h> |
Bram Moolenaar | e4f25e4 | 2017-07-07 11:54:15 +0200 | [diff] [blame] | 12 | |
| 13 | #include "vterm_keycodes.h" |
| 14 | |
Bram Moolenaar | b2a76ec | 2017-07-25 21:34:46 +0200 | [diff] [blame] | 15 | #define TRUE 1 |
| 16 | #define FALSE 0 |
| 17 | |
Bram Moolenaar | db1085a | 2019-08-18 20:41:38 +0200 | [diff] [blame] | 18 | // from stdint.h |
Bram Moolenaar | 607985a | 2017-07-28 17:04:15 +0200 | [diff] [blame] | 19 | typedef unsigned char uint8_t; |
Bram Moolenaar | 7da3415 | 2021-11-24 19:30:55 +0000 | [diff] [blame] | 20 | typedef unsigned short uint16_t; |
Bram Moolenaar | 607985a | 2017-07-28 17:04:15 +0200 | [diff] [blame] | 21 | typedef unsigned int uint32_t; |
| 22 | |
Bram Moolenaar | 6fc3b59 | 2020-05-17 22:27:55 +0200 | [diff] [blame] | 23 | #define VTERM_VERSION_MAJOR 0 |
Bram Moolenaar | 7da3415 | 2021-11-24 19:30:55 +0000 | [diff] [blame] | 24 | #define VTERM_VERSION_MINOR 2 |
Bram Moolenaar | 6fc3b59 | 2020-05-17 22:27:55 +0200 | [diff] [blame] | 25 | |
| 26 | #define VTERM_CHECK_VERSION \ |
| 27 | vterm_check_version(VTERM_VERSION_MAJOR, VTERM_VERSION_MINOR) |
| 28 | |
Bram Moolenaar | e4f25e4 | 2017-07-07 11:54:15 +0200 | [diff] [blame] | 29 | typedef struct VTerm VTerm; |
| 30 | typedef struct VTermState VTermState; |
| 31 | typedef struct VTermScreen VTermScreen; |
| 32 | |
Bram Moolenaar | db1085a | 2019-08-18 20:41:38 +0200 | [diff] [blame] | 33 | // Specifies a screen point. |
Bram Moolenaar | e4f25e4 | 2017-07-07 11:54:15 +0200 | [diff] [blame] | 34 | typedef struct { |
| 35 | int row; |
| 36 | int col; |
| 37 | } VTermPos; |
| 38 | |
Bram Moolenaar | 591cec8 | 2020-05-22 22:06:06 +0200 | [diff] [blame] | 39 | /* some small utility functions; we can just keep these static here */ |
Bram Moolenaar | e4f25e4 | 2017-07-07 11:54:15 +0200 | [diff] [blame] | 40 | |
| 41 | /* |
| 42 | * Order points by on-screen flow order: |
| 43 | * Return < 0 if "a" is before "b" |
| 44 | * Return 0 if "a" and "b" are equal |
| 45 | * Return > 0 if "a" is after "b". |
| 46 | */ |
| 47 | int vterm_pos_cmp(VTermPos a, VTermPos b); |
| 48 | |
| 49 | #if defined(DEFINE_INLINES) || USE_INLINE |
| 50 | INLINE int vterm_pos_cmp(VTermPos a, VTermPos b) |
| 51 | { |
| 52 | return (a.row == b.row) ? a.col - b.col : a.row - b.row; |
| 53 | } |
| 54 | #endif |
| 55 | |
Bram Moolenaar | db1085a | 2019-08-18 20:41:38 +0200 | [diff] [blame] | 56 | // Specifies a rectangular screen area. |
Bram Moolenaar | e4f25e4 | 2017-07-07 11:54:15 +0200 | [diff] [blame] | 57 | typedef struct { |
| 58 | int start_row; |
| 59 | int end_row; |
| 60 | int start_col; |
| 61 | int end_col; |
| 62 | } VTermRect; |
| 63 | |
Bram Moolenaar | 591cec8 | 2020-05-22 22:06:06 +0200 | [diff] [blame] | 64 | /* true if the rect contains the point */ |
Bram Moolenaar | e4f25e4 | 2017-07-07 11:54:15 +0200 | [diff] [blame] | 65 | int vterm_rect_contains(VTermRect r, VTermPos p); |
| 66 | |
| 67 | #if defined(DEFINE_INLINES) || USE_INLINE |
| 68 | INLINE int vterm_rect_contains(VTermRect r, VTermPos p) |
| 69 | { |
| 70 | return p.row >= r.start_row && p.row < r.end_row && |
| 71 | p.col >= r.start_col && p.col < r.end_col; |
| 72 | } |
| 73 | #endif |
| 74 | |
Bram Moolenaar | 591cec8 | 2020-05-22 22:06:06 +0200 | [diff] [blame] | 75 | /* move a rect */ |
Bram Moolenaar | db1085a | 2019-08-18 20:41:38 +0200 | [diff] [blame] | 76 | // Move "rect" "row_delta" down and "col_delta" right. |
| 77 | // Does not check boundaries. |
Bram Moolenaar | e4f25e4 | 2017-07-07 11:54:15 +0200 | [diff] [blame] | 78 | void vterm_rect_move(VTermRect *rect, int row_delta, int col_delta); |
| 79 | |
| 80 | #if defined(DEFINE_INLINES) || USE_INLINE |
| 81 | INLINE void vterm_rect_move(VTermRect *rect, int row_delta, int col_delta) |
| 82 | { |
| 83 | rect->start_row += row_delta; rect->end_row += row_delta; |
| 84 | rect->start_col += col_delta; rect->end_col += col_delta; |
| 85 | } |
| 86 | #endif |
| 87 | |
Bram Moolenaar | e5886cc | 2020-05-21 20:10:04 +0200 | [diff] [blame] | 88 | /** |
| 89 | * Bit-field describing the value of VTermColor.type |
| 90 | */ |
| 91 | typedef enum { |
| 92 | /** |
| 93 | * If the lower bit of `type` is not set, the colour is 24-bit RGB. |
| 94 | */ |
| 95 | VTERM_COLOR_RGB = 0x00, |
| 96 | |
| 97 | /** |
| 98 | * The colour is an index into a palette of 256 colours. |
| 99 | */ |
| 100 | VTERM_COLOR_INDEXED = 0x01, |
| 101 | |
| 102 | /** |
| 103 | * Mask that can be used to extract the RGB/Indexed bit. |
| 104 | */ |
| 105 | VTERM_COLOR_TYPE_MASK = 0x01, |
| 106 | |
| 107 | /** |
| 108 | * If set, indicates that this colour should be the default foreground |
| 109 | * color, i.e. there was no SGR request for another colour. When |
| 110 | * rendering this colour it is possible to ignore "idx" and just use a |
| 111 | * colour that is not in the palette. |
| 112 | */ |
| 113 | VTERM_COLOR_DEFAULT_FG = 0x02, |
| 114 | |
| 115 | /** |
| 116 | * If set, indicates that this colour should be the default background |
| 117 | * color, i.e. there was no SGR request for another colour. A common |
| 118 | * option when rendering this colour is to not render a background at |
| 119 | * all, for example by rendering the window transparently at this spot. |
| 120 | */ |
| 121 | VTERM_COLOR_DEFAULT_BG = 0x04, |
| 122 | |
| 123 | /** |
| 124 | * Mask that can be used to extract the default foreground/background bit. |
| 125 | */ |
Bram Moolenaar | 87fd092 | 2021-11-20 13:47:45 +0000 | [diff] [blame] | 126 | VTERM_COLOR_DEFAULT_MASK = 0x06, |
| 127 | |
| 128 | /** |
| 129 | * If set, indicates that the color is invalid. |
| 130 | */ |
| 131 | VTERM_COLOR_INVALID = 0x08 |
Bram Moolenaar | e5886cc | 2020-05-21 20:10:04 +0200 | [diff] [blame] | 132 | } VTermColorType; |
| 133 | |
| 134 | /** |
| 135 | * Returns true if the VTERM_COLOR_RGB `type` flag is set, indicating that the |
| 136 | * given VTermColor instance is an indexed colour. |
| 137 | */ |
| 138 | #define VTERM_COLOR_IS_INDEXED(col) \ |
| 139 | (((col)->type & VTERM_COLOR_TYPE_MASK) == VTERM_COLOR_INDEXED) |
| 140 | |
| 141 | /** |
| 142 | * Returns true if the VTERM_COLOR_INDEXED `type` flag is set, indicating that |
| 143 | * the given VTermColor instance is an rgb colour. |
| 144 | */ |
| 145 | #define VTERM_COLOR_IS_RGB(col) \ |
| 146 | (((col)->type & VTERM_COLOR_TYPE_MASK) == VTERM_COLOR_RGB) |
| 147 | |
| 148 | /** |
| 149 | * Returns true if the VTERM_COLOR_DEFAULT_FG `type` flag is set, indicating |
| 150 | * that the given VTermColor instance corresponds to the default foreground |
| 151 | * color. |
| 152 | */ |
| 153 | #define VTERM_COLOR_IS_DEFAULT_FG(col) \ |
| 154 | (!!((col)->type & VTERM_COLOR_DEFAULT_FG)) |
| 155 | |
| 156 | /** |
| 157 | * Returns true if the VTERM_COLOR_DEFAULT_BG `type` flag is set, indicating |
| 158 | * that the given VTermColor instance corresponds to the default background |
| 159 | * color. |
| 160 | */ |
| 161 | #define VTERM_COLOR_IS_DEFAULT_BG(col) \ |
| 162 | (!!((col)->type & VTERM_COLOR_DEFAULT_BG)) |
Bram Moolenaar | 46359e1 | 2017-11-29 22:33:38 +0100 | [diff] [blame] | 163 | |
Bram Moolenaar | 87fd092 | 2021-11-20 13:47:45 +0000 | [diff] [blame] | 164 | /** |
| 165 | * Returns true if the VTERM_COLOR_INVALID `type` flag is set, indicating |
| 166 | * that the given VTermColor instance is an invalid color. |
| 167 | */ |
| 168 | #define VTERM_COLOR_IS_INVALID(col) (!!((col)->type & VTERM_COLOR_INVALID)) |
| 169 | |
Bram Moolenaar | e4f25e4 | 2017-07-07 11:54:15 +0200 | [diff] [blame] | 170 | typedef struct { |
Bram Moolenaar | e5886cc | 2020-05-21 20:10:04 +0200 | [diff] [blame] | 171 | /** |
| 172 | * Tag indicating which member is actually valid. |
| 173 | * Please use the `VTERM_COLOR_IS_*` test macros to check whether a |
| 174 | * particular type flag is set. |
| 175 | */ |
| 176 | uint8_t type; |
| 177 | |
Bram Moolenaar | e4f25e4 | 2017-07-07 11:54:15 +0200 | [diff] [blame] | 178 | uint8_t red, green, blue; |
Bram Moolenaar | e5886cc | 2020-05-21 20:10:04 +0200 | [diff] [blame] | 179 | |
| 180 | uint8_t index; |
Bram Moolenaar | e4f25e4 | 2017-07-07 11:54:15 +0200 | [diff] [blame] | 181 | } VTermColor; |
| 182 | |
Bram Moolenaar | e5886cc | 2020-05-21 20:10:04 +0200 | [diff] [blame] | 183 | /** |
| 184 | * Constructs a new VTermColor instance representing the given RGB values. |
| 185 | */ |
| 186 | void vterm_color_rgb(VTermColor *col, uint8_t red, uint8_t green, uint8_t blue); |
| 187 | |
| 188 | /** |
| 189 | * Construct a new VTermColor instance representing an indexed color with the |
| 190 | * given index. |
| 191 | */ |
| 192 | void vterm_color_indexed(VTermColor *col, uint8_t idx); |
| 193 | |
| 194 | /** |
| 195 | * Compares two colours. Returns true if the colors are equal, false otherwise. |
| 196 | */ |
| 197 | int vterm_color_is_equal(const VTermColor *a, const VTermColor *b); |
| 198 | |
Bram Moolenaar | e4f25e4 | 2017-07-07 11:54:15 +0200 | [diff] [blame] | 199 | typedef enum { |
Bram Moolenaar | 591cec8 | 2020-05-22 22:06:06 +0200 | [diff] [blame] | 200 | /* VTERM_VALUETYPE_NONE = 0 */ |
Bram Moolenaar | e4f25e4 | 2017-07-07 11:54:15 +0200 | [diff] [blame] | 201 | VTERM_VALUETYPE_BOOL = 1, |
| 202 | VTERM_VALUETYPE_INT, |
| 203 | VTERM_VALUETYPE_STRING, |
Bram Moolenaar | b5b49a3 | 2018-03-25 16:20:37 +0200 | [diff] [blame] | 204 | VTERM_VALUETYPE_COLOR, |
| 205 | |
| 206 | VTERM_N_VALUETYPES |
Bram Moolenaar | e4f25e4 | 2017-07-07 11:54:15 +0200 | [diff] [blame] | 207 | } VTermValueType; |
| 208 | |
Bram Moolenaar | be593bf | 2020-05-19 21:20:04 +0200 | [diff] [blame] | 209 | typedef struct { |
| 210 | const char *str; |
| 211 | size_t len : 30; |
| 212 | unsigned int initial : 1; |
| 213 | unsigned int final : 1; |
| 214 | } VTermStringFragment; |
| 215 | |
Bram Moolenaar | e4f25e4 | 2017-07-07 11:54:15 +0200 | [diff] [blame] | 216 | typedef union { |
| 217 | int boolean; |
| 218 | int number; |
Bram Moolenaar | be593bf | 2020-05-19 21:20:04 +0200 | [diff] [blame] | 219 | VTermStringFragment string; |
Bram Moolenaar | e4f25e4 | 2017-07-07 11:54:15 +0200 | [diff] [blame] | 220 | VTermColor color; |
| 221 | } VTermValue; |
| 222 | |
| 223 | typedef enum { |
Bram Moolenaar | 591cec8 | 2020-05-22 22:06:06 +0200 | [diff] [blame] | 224 | /* VTERM_ATTR_NONE = 0 */ |
Bram Moolenaar | b691de0 | 2018-04-24 18:39:14 +0200 | [diff] [blame] | 225 | VTERM_ATTR_BOLD = 1, // bool: 1, 22 |
| 226 | VTERM_ATTR_UNDERLINE, // number: 4, 21, 24 |
| 227 | VTERM_ATTR_ITALIC, // bool: 3, 23 |
| 228 | VTERM_ATTR_BLINK, // bool: 5, 25 |
| 229 | VTERM_ATTR_REVERSE, // bool: 7, 27 |
Bram Moolenaar | d863728 | 2020-05-20 18:41:41 +0200 | [diff] [blame] | 230 | VTERM_ATTR_CONCEAL, // bool: 8, 28 |
Bram Moolenaar | b691de0 | 2018-04-24 18:39:14 +0200 | [diff] [blame] | 231 | VTERM_ATTR_STRIKE, // bool: 9, 29 |
| 232 | VTERM_ATTR_FONT, // number: 10-19 |
| 233 | VTERM_ATTR_FOREGROUND, // color: 30-39 90-97 |
| 234 | VTERM_ATTR_BACKGROUND, // color: 40-49 100-107 |
Bram Moolenaar | b5b49a3 | 2018-03-25 16:20:37 +0200 | [diff] [blame] | 235 | |
| 236 | VTERM_N_ATTRS |
Bram Moolenaar | e4f25e4 | 2017-07-07 11:54:15 +0200 | [diff] [blame] | 237 | } VTermAttr; |
| 238 | |
| 239 | typedef enum { |
Bram Moolenaar | 591cec8 | 2020-05-22 22:06:06 +0200 | [diff] [blame] | 240 | /* VTERM_PROP_NONE = 0 */ |
Bram Moolenaar | b691de0 | 2018-04-24 18:39:14 +0200 | [diff] [blame] | 241 | VTERM_PROP_CURSORVISIBLE = 1, // bool |
| 242 | VTERM_PROP_CURSORBLINK, // bool |
| 243 | VTERM_PROP_ALTSCREEN, // bool |
| 244 | VTERM_PROP_TITLE, // string |
| 245 | VTERM_PROP_ICONNAME, // string |
| 246 | VTERM_PROP_REVERSE, // bool |
| 247 | VTERM_PROP_CURSORSHAPE, // number |
| 248 | VTERM_PROP_MOUSE, // number |
| 249 | VTERM_PROP_CURSORCOLOR, // string |
Bram Moolenaar | b5b49a3 | 2018-03-25 16:20:37 +0200 | [diff] [blame] | 250 | |
| 251 | VTERM_N_PROPS |
Bram Moolenaar | e4f25e4 | 2017-07-07 11:54:15 +0200 | [diff] [blame] | 252 | } VTermProp; |
| 253 | |
| 254 | enum { |
| 255 | VTERM_PROP_CURSORSHAPE_BLOCK = 1, |
| 256 | VTERM_PROP_CURSORSHAPE_UNDERLINE, |
Bram Moolenaar | b5b49a3 | 2018-03-25 16:20:37 +0200 | [diff] [blame] | 257 | VTERM_PROP_CURSORSHAPE_BAR_LEFT, |
| 258 | |
| 259 | VTERM_N_PROP_CURSORSHAPES |
Bram Moolenaar | e4f25e4 | 2017-07-07 11:54:15 +0200 | [diff] [blame] | 260 | }; |
| 261 | |
| 262 | enum { |
| 263 | VTERM_PROP_MOUSE_NONE = 0, |
| 264 | VTERM_PROP_MOUSE_CLICK, |
| 265 | VTERM_PROP_MOUSE_DRAG, |
Bram Moolenaar | b5b49a3 | 2018-03-25 16:20:37 +0200 | [diff] [blame] | 266 | VTERM_PROP_MOUSE_MOVE, |
| 267 | |
| 268 | VTERM_N_PROP_MOUSES |
Bram Moolenaar | e4f25e4 | 2017-07-07 11:54:15 +0200 | [diff] [blame] | 269 | }; |
| 270 | |
Bram Moolenaar | 7da3415 | 2021-11-24 19:30:55 +0000 | [diff] [blame] | 271 | typedef enum { |
| 272 | VTERM_SELECTION_CLIPBOARD = (1<<0), |
| 273 | VTERM_SELECTION_PRIMARY = (1<<1), |
| 274 | VTERM_SELECTION_SECONDARY = (1<<2), |
| 275 | VTERM_SELECTION_SELECT = (1<<3), |
| 276 | VTERM_SELECTION_CUT0 = (1<<4), /* also CUT1 .. CUT7 by bitshifting */ |
| 277 | } VTermSelectionMask; |
| 278 | |
Bram Moolenaar | e4f25e4 | 2017-07-07 11:54:15 +0200 | [diff] [blame] | 279 | typedef struct { |
| 280 | const uint32_t *chars; |
| 281 | int width; |
Bram Moolenaar | 591cec8 | 2020-05-22 22:06:06 +0200 | [diff] [blame] | 282 | unsigned int protected_cell:1; /* DECSCA-protected against DECSEL/DECSED */ |
| 283 | unsigned int dwl:1; /* DECDWL or DECDHL double-width line */ |
| 284 | unsigned int dhl:2; /* DECDHL double-height line (1=top 2=bottom) */ |
Bram Moolenaar | e4f25e4 | 2017-07-07 11:54:15 +0200 | [diff] [blame] | 285 | } VTermGlyphInfo; |
| 286 | |
| 287 | typedef struct { |
Bram Moolenaar | 88d68de | 2020-05-18 21:51:01 +0200 | [diff] [blame] | 288 | unsigned int doublewidth:1; /* DECDWL or DECDHL line */ |
| 289 | unsigned int doubleheight:2; /* DECDHL line (1=top 2=bottom) */ |
| 290 | unsigned int continuation:1; /* Line is a flow continuation of the previous */ |
Bram Moolenaar | e4f25e4 | 2017-07-07 11:54:15 +0200 | [diff] [blame] | 291 | } VTermLineInfo; |
| 292 | |
Bram Moolenaar | 591cec8 | 2020-05-22 22:06:06 +0200 | [diff] [blame] | 293 | /* Copies of VTermState fields that the 'resize' callback might have reason to |
| 294 | * edit. 'resize' callback gets total control of these fields and may |
| 295 | * free-and-reallocate them if required. They will be copied back from the |
| 296 | * struct after the callback has returned. |
| 297 | */ |
Bram Moolenaar | e4f25e4 | 2017-07-07 11:54:15 +0200 | [diff] [blame] | 298 | typedef struct { |
Bram Moolenaar | 591cec8 | 2020-05-22 22:06:06 +0200 | [diff] [blame] | 299 | VTermPos pos; /* current cursor position */ |
| 300 | } VTermStateFields; |
| 301 | |
| 302 | typedef struct { |
| 303 | /* libvterm relies on this memory to be zeroed out before it is returned |
| 304 | * by the allocator. */ |
Bram Moolenaar | e4f25e4 | 2017-07-07 11:54:15 +0200 | [diff] [blame] | 305 | void *(*malloc)(size_t size, void *allocdata); |
| 306 | void (*free)(void *ptr, void *allocdata); |
| 307 | } VTermAllocatorFunctions; |
| 308 | |
Bram Moolenaar | 6fc3b59 | 2020-05-17 22:27:55 +0200 | [diff] [blame] | 309 | void vterm_check_version(int major, int minor); |
| 310 | |
Bram Moolenaar | db1085a | 2019-08-18 20:41:38 +0200 | [diff] [blame] | 311 | // Allocate and initialize a new terminal with default allocators. |
Bram Moolenaar | e4f25e4 | 2017-07-07 11:54:15 +0200 | [diff] [blame] | 312 | VTerm *vterm_new(int rows, int cols); |
| 313 | |
Bram Moolenaar | db1085a | 2019-08-18 20:41:38 +0200 | [diff] [blame] | 314 | // Allocate and initialize a new terminal with specified allocators. |
Bram Moolenaar | e4f25e4 | 2017-07-07 11:54:15 +0200 | [diff] [blame] | 315 | VTerm *vterm_new_with_allocator(int rows, int cols, VTermAllocatorFunctions *funcs, void *allocdata); |
| 316 | |
Bram Moolenaar | db1085a | 2019-08-18 20:41:38 +0200 | [diff] [blame] | 317 | // Free and cleanup a terminal and all its data. |
Bram Moolenaar | e4f25e4 | 2017-07-07 11:54:15 +0200 | [diff] [blame] | 318 | void vterm_free(VTerm* vt); |
| 319 | |
Bram Moolenaar | db1085a | 2019-08-18 20:41:38 +0200 | [diff] [blame] | 320 | // Get the current size of the terminal and store in "rowsp" and "colsp". |
Bram Moolenaar | e4f25e4 | 2017-07-07 11:54:15 +0200 | [diff] [blame] | 321 | void vterm_get_size(const VTerm *vt, int *rowsp, int *colsp); |
Bram Moolenaar | 9cc5f75 | 2017-07-23 22:07:27 +0200 | [diff] [blame] | 322 | |
Bram Moolenaar | e4f25e4 | 2017-07-07 11:54:15 +0200 | [diff] [blame] | 323 | void vterm_set_size(VTerm *vt, int rows, int cols); |
| 324 | |
| 325 | int vterm_get_utf8(const VTerm *vt); |
| 326 | void vterm_set_utf8(VTerm *vt, int is_utf8); |
| 327 | |
| 328 | size_t vterm_input_write(VTerm *vt, const char *bytes, size_t len); |
| 329 | |
Bram Moolenaar | 94d729c | 2020-05-17 21:50:16 +0200 | [diff] [blame] | 330 | /* Setting output callback will override the buffer logic */ |
| 331 | typedef void VTermOutputCallback(const char *s, size_t len, void *user); |
| 332 | void vterm_output_set_callback(VTerm *vt, VTermOutputCallback *func, void *user); |
| 333 | |
| 334 | /* These buffer functions only work if output callback is NOT set |
| 335 | * These are deprecated and will be removed in a later version */ |
Bram Moolenaar | e4f25e4 | 2017-07-07 11:54:15 +0200 | [diff] [blame] | 336 | size_t vterm_output_get_buffer_size(const VTerm *vt); |
| 337 | size_t vterm_output_get_buffer_current(const VTerm *vt); |
| 338 | size_t vterm_output_get_buffer_remaining(const VTerm *vt); |
| 339 | |
Bram Moolenaar | 94d729c | 2020-05-17 21:50:16 +0200 | [diff] [blame] | 340 | /* This too */ |
Bram Moolenaar | e4f25e4 | 2017-07-07 11:54:15 +0200 | [diff] [blame] | 341 | size_t vterm_output_read(VTerm *vt, char *buffer, size_t len); |
| 342 | |
Bram Moolenaar | 6a0299d | 2019-10-10 21:14:03 +0200 | [diff] [blame] | 343 | int vterm_is_modify_other_keys(VTerm *vt); |
Bram Moolenaar | e4f25e4 | 2017-07-07 11:54:15 +0200 | [diff] [blame] | 344 | void vterm_keyboard_unichar(VTerm *vt, uint32_t c, VTermModifier mod); |
| 345 | void vterm_keyboard_key(VTerm *vt, VTermKey key, VTermModifier mod); |
| 346 | |
| 347 | void vterm_keyboard_start_paste(VTerm *vt); |
| 348 | void vterm_keyboard_end_paste(VTerm *vt); |
| 349 | |
| 350 | void vterm_mouse_move(VTerm *vt, int row, int col, VTermModifier mod); |
Bram Moolenaar | db1085a | 2019-08-18 20:41:38 +0200 | [diff] [blame] | 351 | // "button" is 1 for left, 2 for middle, 3 for right. |
| 352 | // Button 4 is scroll wheel down, button 5 is scroll wheel up. |
Bram Moolenaar | b2a76ec | 2017-07-25 21:34:46 +0200 | [diff] [blame] | 353 | void vterm_mouse_button(VTerm *vt, int button, int pressed, VTermModifier mod); |
Bram Moolenaar | e4f25e4 | 2017-07-07 11:54:15 +0200 | [diff] [blame] | 354 | |
Bram Moolenaar | b691de0 | 2018-04-24 18:39:14 +0200 | [diff] [blame] | 355 | // ------------ |
| 356 | // Parser layer |
| 357 | // ------------ |
Bram Moolenaar | e4f25e4 | 2017-07-07 11:54:15 +0200 | [diff] [blame] | 358 | |
Bram Moolenaar | 591cec8 | 2020-05-22 22:06:06 +0200 | [diff] [blame] | 359 | /* Flag to indicate non-final subparameters in a single CSI parameter. |
| 360 | * Consider |
| 361 | * CSI 1;2:3:4;5a |
| 362 | * 1 4 and 5 are final. |
| 363 | * 2 and 3 are non-final and will have this bit set |
| 364 | * |
| 365 | * Don't confuse this with the final byte of the CSI escape; 'a' in this case. |
| 366 | */ |
Bram Moolenaar | b5b49a3 | 2018-03-25 16:20:37 +0200 | [diff] [blame] | 367 | #define CSI_ARG_FLAG_MORE (1U<<31) |
| 368 | #define CSI_ARG_MASK (~(1U<<31)) |
Bram Moolenaar | e4f25e4 | 2017-07-07 11:54:15 +0200 | [diff] [blame] | 369 | |
| 370 | #define CSI_ARG_HAS_MORE(a) ((a) & CSI_ARG_FLAG_MORE) |
| 371 | #define CSI_ARG(a) ((a) & CSI_ARG_MASK) |
| 372 | |
Bram Moolenaar | 591cec8 | 2020-05-22 22:06:06 +0200 | [diff] [blame] | 373 | /* Can't use -1 to indicate a missing argument; use this instead */ |
Bram Moolenaar | 9cc5f75 | 2017-07-23 22:07:27 +0200 | [diff] [blame] | 374 | #define CSI_ARG_MISSING ((1<<30)-1) |
Bram Moolenaar | e4f25e4 | 2017-07-07 11:54:15 +0200 | [diff] [blame] | 375 | |
| 376 | #define CSI_ARG_IS_MISSING(a) (CSI_ARG(a) == CSI_ARG_MISSING) |
| 377 | #define CSI_ARG_OR(a,def) (CSI_ARG(a) == CSI_ARG_MISSING ? (def) : CSI_ARG(a)) |
| 378 | #define CSI_ARG_COUNT(a) (CSI_ARG(a) == CSI_ARG_MISSING || CSI_ARG(a) == 0 ? 1 : CSI_ARG(a)) |
| 379 | |
| 380 | typedef struct { |
| 381 | int (*text)(const char *bytes, size_t len, void *user); |
| 382 | int (*control)(unsigned char control, void *user); |
| 383 | int (*escape)(const char *bytes, size_t len, void *user); |
| 384 | int (*csi)(const char *leader, const long args[], int argcount, const char *intermed, char command, void *user); |
Bram Moolenaar | be593bf | 2020-05-19 21:20:04 +0200 | [diff] [blame] | 385 | int (*osc)(int command, VTermStringFragment frag, void *user); |
| 386 | int (*dcs)(const char *command, size_t commandlen, VTermStringFragment frag, void *user); |
Bram Moolenaar | 7da3415 | 2021-11-24 19:30:55 +0000 | [diff] [blame] | 387 | int (*apc)(VTermStringFragment frag, void *user); |
| 388 | int (*pm)(VTermStringFragment frag, void *user); |
| 389 | int (*sos)(VTermStringFragment frag, void *user); |
Bram Moolenaar | e4f25e4 | 2017-07-07 11:54:15 +0200 | [diff] [blame] | 390 | int (*resize)(int rows, int cols, void *user); |
| 391 | } VTermParserCallbacks; |
| 392 | |
| 393 | void vterm_parser_set_callbacks(VTerm *vt, const VTermParserCallbacks *callbacks, void *user); |
| 394 | void *vterm_parser_get_cbdata(VTerm *vt); |
| 395 | |
Bram Moolenaar | b691de0 | 2018-04-24 18:39:14 +0200 | [diff] [blame] | 396 | // ----------- |
| 397 | // State layer |
| 398 | // ----------- |
Bram Moolenaar | e4f25e4 | 2017-07-07 11:54:15 +0200 | [diff] [blame] | 399 | |
| 400 | typedef struct { |
| 401 | int (*putglyph)(VTermGlyphInfo *info, VTermPos pos, void *user); |
| 402 | int (*movecursor)(VTermPos pos, VTermPos oldpos, int visible, void *user); |
| 403 | int (*scrollrect)(VTermRect rect, int downward, int rightward, void *user); |
| 404 | int (*moverect)(VTermRect dest, VTermRect src, void *user); |
| 405 | int (*erase)(VTermRect rect, int selective, void *user); |
| 406 | int (*initpen)(void *user); |
| 407 | int (*setpenattr)(VTermAttr attr, VTermValue *val, void *user); |
Bram Moolenaar | db1085a | 2019-08-18 20:41:38 +0200 | [diff] [blame] | 408 | // Callback for setting various properties. Must return 1 if the property |
| 409 | // was accepted, 0 otherwise. |
Bram Moolenaar | e4f25e4 | 2017-07-07 11:54:15 +0200 | [diff] [blame] | 410 | int (*settermprop)(VTermProp prop, VTermValue *val, void *user); |
| 411 | int (*bell)(void *user); |
Bram Moolenaar | d098b82 | 2020-05-18 21:12:59 +0200 | [diff] [blame] | 412 | int (*resize)(int rows, int cols, VTermStateFields *fields, void *user); |
Bram Moolenaar | e4f25e4 | 2017-07-07 11:54:15 +0200 | [diff] [blame] | 413 | int (*setlineinfo)(int row, const VTermLineInfo *newinfo, const VTermLineInfo *oldinfo, void *user); |
| 414 | } VTermStateCallbacks; |
| 415 | |
Bram Moolenaar | c48369c | 2018-03-11 19:30:45 +0100 | [diff] [blame] | 416 | typedef struct { |
| 417 | VTermPos pos; |
| 418 | int buttons; |
| 419 | #define MOUSE_BUTTON_LEFT 0x01 |
| 420 | #define MOUSE_BUTTON_MIDDLE 0x02 |
| 421 | #define MOUSE_BUTTON_RIGHT 0x04 |
| 422 | int flags; |
| 423 | #define MOUSE_WANT_CLICK 0x01 |
| 424 | #define MOUSE_WANT_DRAG 0x02 |
| 425 | #define MOUSE_WANT_MOVE 0x04 |
Bram Moolenaar | db1085a | 2019-08-18 20:41:38 +0200 | [diff] [blame] | 426 | // useful to add protocol? |
Bram Moolenaar | c48369c | 2018-03-11 19:30:45 +0100 | [diff] [blame] | 427 | } VTermMouseState; |
| 428 | |
Bram Moolenaar | d863728 | 2020-05-20 18:41:41 +0200 | [diff] [blame] | 429 | typedef struct { |
| 430 | int (*control)(unsigned char control, void *user); |
| 431 | int (*csi)(const char *leader, const long args[], int argcount, const char *intermed, char command, void *user); |
| 432 | int (*osc)(int command, VTermStringFragment frag, void *user); |
| 433 | int (*dcs)(const char *command, size_t commandlen, VTermStringFragment frag, void *user); |
Bram Moolenaar | 7da3415 | 2021-11-24 19:30:55 +0000 | [diff] [blame] | 434 | int (*apc)(VTermStringFragment frag, void *user); |
| 435 | int (*pm)(VTermStringFragment frag, void *user); |
| 436 | int (*sos)(VTermStringFragment frag, void *user); |
Bram Moolenaar | d863728 | 2020-05-20 18:41:41 +0200 | [diff] [blame] | 437 | } VTermStateFallbacks; |
| 438 | |
Bram Moolenaar | 7da3415 | 2021-11-24 19:30:55 +0000 | [diff] [blame] | 439 | typedef struct { |
| 440 | int (*set)(VTermSelectionMask mask, VTermStringFragment frag, void *user); |
| 441 | int (*query)(VTermSelectionMask mask, void *user); |
| 442 | } VTermSelectionCallbacks; |
| 443 | |
Bram Moolenaar | e4f25e4 | 2017-07-07 11:54:15 +0200 | [diff] [blame] | 444 | VTermState *vterm_obtain_state(VTerm *vt); |
| 445 | |
| 446 | void vterm_state_set_callbacks(VTermState *state, const VTermStateCallbacks *callbacks, void *user); |
| 447 | void *vterm_state_get_cbdata(VTermState *state); |
| 448 | |
Bram Moolenaar | d863728 | 2020-05-20 18:41:41 +0200 | [diff] [blame] | 449 | void vterm_state_set_unrecognised_fallbacks(VTermState *state, const VTermStateFallbacks *fallbacks, void *user); |
Bram Moolenaar | e4f25e4 | 2017-07-07 11:54:15 +0200 | [diff] [blame] | 450 | void *vterm_state_get_unrecognised_fbdata(VTermState *state); |
| 451 | |
Bram Moolenaar | db1085a | 2019-08-18 20:41:38 +0200 | [diff] [blame] | 452 | // Initialize the state. |
Bram Moolenaar | e4f25e4 | 2017-07-07 11:54:15 +0200 | [diff] [blame] | 453 | void vterm_state_reset(VTermState *state, int hard); |
Bram Moolenaar | 9cc5f75 | 2017-07-23 22:07:27 +0200 | [diff] [blame] | 454 | |
Bram Moolenaar | e4f25e4 | 2017-07-07 11:54:15 +0200 | [diff] [blame] | 455 | void vterm_state_get_cursorpos(const VTermState *state, VTermPos *cursorpos); |
Bram Moolenaar | c48369c | 2018-03-11 19:30:45 +0100 | [diff] [blame] | 456 | void vterm_state_get_mousestate(const VTermState *state, VTermMouseState *mousestate); |
Bram Moolenaar | e4f25e4 | 2017-07-07 11:54:15 +0200 | [diff] [blame] | 457 | void vterm_state_get_default_colors(const VTermState *state, VTermColor *default_fg, VTermColor *default_bg); |
| 458 | void vterm_state_get_palette_color(const VTermState *state, int index, VTermColor *col); |
| 459 | void vterm_state_set_default_colors(VTermState *state, const VTermColor *default_fg, const VTermColor *default_bg); |
| 460 | void vterm_state_set_palette_color(VTermState *state, int index, const VTermColor *col); |
| 461 | void vterm_state_set_bold_highbright(VTermState *state, int bold_is_highbright); |
| 462 | int vterm_state_get_penattr(const VTermState *state, VTermAttr attr, VTermValue *val); |
| 463 | int vterm_state_set_termprop(VTermState *state, VTermProp prop, VTermValue *val); |
Bram Moolenaar | b5b49a3 | 2018-03-25 16:20:37 +0200 | [diff] [blame] | 464 | void vterm_state_focus_in(VTermState *state); |
| 465 | void vterm_state_focus_out(VTermState *state); |
Bram Moolenaar | e4f25e4 | 2017-07-07 11:54:15 +0200 | [diff] [blame] | 466 | const VTermLineInfo *vterm_state_get_lineinfo(const VTermState *state, int row); |
| 467 | |
Bram Moolenaar | e5886cc | 2020-05-21 20:10:04 +0200 | [diff] [blame] | 468 | /** |
| 469 | * Makes sure that the given color `col` is indeed an RGB colour. After this |
| 470 | * function returns, VTERM_COLOR_IS_RGB(col) will return true, while all other |
| 471 | * flags stored in `col->type` will have been reset. |
| 472 | * |
| 473 | * @param state is the VTermState instance from which the colour palette should |
| 474 | * be extracted. |
| 475 | * @param col is a pointer at the VTermColor instance that should be converted |
| 476 | * to an RGB colour. |
| 477 | */ |
| 478 | void vterm_state_convert_color_to_rgb(const VTermState *state, VTermColor *col); |
| 479 | |
Bram Moolenaar | 7da3415 | 2021-11-24 19:30:55 +0000 | [diff] [blame] | 480 | void vterm_state_set_selection_callbacks(VTermState *state, const VTermSelectionCallbacks *callbacks, void *user, |
| 481 | char *buffer, size_t buflen); |
| 482 | |
| 483 | void vterm_state_send_selection(VTermState *state, VTermSelectionMask mask, VTermStringFragment frag); |
| 484 | |
Bram Moolenaar | b691de0 | 2018-04-24 18:39:14 +0200 | [diff] [blame] | 485 | // ------------ |
| 486 | // Screen layer |
| 487 | // ------------ |
Bram Moolenaar | e4f25e4 | 2017-07-07 11:54:15 +0200 | [diff] [blame] | 488 | |
| 489 | typedef struct { |
| 490 | unsigned int bold : 1; |
| 491 | unsigned int underline : 2; |
| 492 | unsigned int italic : 1; |
| 493 | unsigned int blink : 1; |
| 494 | unsigned int reverse : 1; |
Bram Moolenaar | d863728 | 2020-05-20 18:41:41 +0200 | [diff] [blame] | 495 | unsigned int conceal : 1; |
Bram Moolenaar | e4f25e4 | 2017-07-07 11:54:15 +0200 | [diff] [blame] | 496 | unsigned int strike : 1; |
Bram Moolenaar | 591cec8 | 2020-05-22 22:06:06 +0200 | [diff] [blame] | 497 | unsigned int font : 4; /* 0 to 9 */ |
| 498 | unsigned int dwl : 1; /* On a DECDWL or DECDHL line */ |
| 499 | unsigned int dhl : 2; /* On a DECDHL line (1=top 2=bottom) */ |
Bram Moolenaar | e4f25e4 | 2017-07-07 11:54:15 +0200 | [diff] [blame] | 500 | } VTermScreenCellAttrs; |
| 501 | |
Bram Moolenaar | 6fc3b59 | 2020-05-17 22:27:55 +0200 | [diff] [blame] | 502 | enum { |
| 503 | VTERM_UNDERLINE_OFF, |
| 504 | VTERM_UNDERLINE_SINGLE, |
| 505 | VTERM_UNDERLINE_DOUBLE, |
| 506 | VTERM_UNDERLINE_CURLY, |
| 507 | }; |
| 508 | |
Bram Moolenaar | e4f25e4 | 2017-07-07 11:54:15 +0200 | [diff] [blame] | 509 | typedef struct { |
| 510 | #define VTERM_MAX_CHARS_PER_CELL 6 |
| 511 | uint32_t chars[VTERM_MAX_CHARS_PER_CELL]; |
| 512 | char width; |
| 513 | VTermScreenCellAttrs attrs; |
| 514 | VTermColor fg, bg; |
| 515 | } VTermScreenCell; |
| 516 | |
Bram Moolenaar | db1085a | 2019-08-18 20:41:38 +0200 | [diff] [blame] | 517 | // All fields are optional, NULL when not used. |
Bram Moolenaar | e4f25e4 | 2017-07-07 11:54:15 +0200 | [diff] [blame] | 518 | typedef struct { |
| 519 | int (*damage)(VTermRect rect, void *user); |
| 520 | int (*moverect)(VTermRect dest, VTermRect src, void *user); |
| 521 | int (*movecursor)(VTermPos pos, VTermPos oldpos, int visible, void *user); |
| 522 | int (*settermprop)(VTermProp prop, VTermValue *val, void *user); |
| 523 | int (*bell)(void *user); |
| 524 | int (*resize)(int rows, int cols, void *user); |
Bram Moolenaar | db1085a | 2019-08-18 20:41:38 +0200 | [diff] [blame] | 525 | // A line was pushed off the top of the window. |
| 526 | // "cells[cols]" contains the cells of that line. |
| 527 | // Return value is unused. |
Bram Moolenaar | e4f25e4 | 2017-07-07 11:54:15 +0200 | [diff] [blame] | 528 | int (*sb_pushline)(int cols, const VTermScreenCell *cells, void *user); |
| 529 | int (*sb_popline)(int cols, VTermScreenCell *cells, void *user); |
| 530 | } VTermScreenCallbacks; |
| 531 | |
Bram Moolenaar | db1085a | 2019-08-18 20:41:38 +0200 | [diff] [blame] | 532 | // Return the screen of the vterm. |
Bram Moolenaar | e4f25e4 | 2017-07-07 11:54:15 +0200 | [diff] [blame] | 533 | VTermScreen *vterm_obtain_screen(VTerm *vt); |
| 534 | |
| 535 | /* |
| 536 | * Install screen callbacks. These are invoked when the screen contents is |
| 537 | * changed. "user" is passed into to the callback. |
| 538 | */ |
| 539 | void vterm_screen_set_callbacks(VTermScreen *screen, const VTermScreenCallbacks *callbacks, void *user); |
| 540 | void *vterm_screen_get_cbdata(VTermScreen *screen); |
| 541 | |
Bram Moolenaar | d863728 | 2020-05-20 18:41:41 +0200 | [diff] [blame] | 542 | void vterm_screen_set_unrecognised_fallbacks(VTermScreen *screen, const VTermStateFallbacks *fallbacks, void *user); |
Bram Moolenaar | e4f25e4 | 2017-07-07 11:54:15 +0200 | [diff] [blame] | 543 | void *vterm_screen_get_unrecognised_fbdata(VTermScreen *screen); |
| 544 | |
Bram Moolenaar | db1085a | 2019-08-18 20:41:38 +0200 | [diff] [blame] | 545 | // Enable support for using the alternate screen if "altscreen" is non-zero. |
| 546 | // Before that switching to the alternate screen won't work. |
| 547 | // Calling with "altscreen" zero has no effect. |
Bram Moolenaar | e4f25e4 | 2017-07-07 11:54:15 +0200 | [diff] [blame] | 548 | void vterm_screen_enable_altscreen(VTermScreen *screen, int altscreen); |
| 549 | |
| 550 | typedef enum { |
Bram Moolenaar | 591cec8 | 2020-05-22 22:06:06 +0200 | [diff] [blame] | 551 | VTERM_DAMAGE_CELL, /* every cell */ |
| 552 | VTERM_DAMAGE_ROW, /* entire rows */ |
| 553 | VTERM_DAMAGE_SCREEN, /* entire screen */ |
| 554 | VTERM_DAMAGE_SCROLL, /* entire screen + scrollrect */ |
Bram Moolenaar | b5b49a3 | 2018-03-25 16:20:37 +0200 | [diff] [blame] | 555 | |
| 556 | VTERM_N_DAMAGES |
Bram Moolenaar | e4f25e4 | 2017-07-07 11:54:15 +0200 | [diff] [blame] | 557 | } VTermDamageSize; |
| 558 | |
Bram Moolenaar | db1085a | 2019-08-18 20:41:38 +0200 | [diff] [blame] | 559 | // Invoke the relevant callbacks to update the screen. |
Bram Moolenaar | e4f25e4 | 2017-07-07 11:54:15 +0200 | [diff] [blame] | 560 | void vterm_screen_flush_damage(VTermScreen *screen); |
Bram Moolenaar | 9cc5f75 | 2017-07-23 22:07:27 +0200 | [diff] [blame] | 561 | |
Bram Moolenaar | e4f25e4 | 2017-07-07 11:54:15 +0200 | [diff] [blame] | 562 | void vterm_screen_set_damage_merge(VTermScreen *screen, VTermDamageSize size); |
| 563 | |
Bram Moolenaar | 9cc5f75 | 2017-07-23 22:07:27 +0200 | [diff] [blame] | 564 | /* |
| 565 | * Reset the screen. Also invokes vterm_state_reset(). |
| 566 | * Must be called before the terminal can be used. |
| 567 | */ |
Bram Moolenaar | e4f25e4 | 2017-07-07 11:54:15 +0200 | [diff] [blame] | 568 | void vterm_screen_reset(VTermScreen *screen, int hard); |
| 569 | |
Bram Moolenaar | 591cec8 | 2020-05-22 22:06:06 +0200 | [diff] [blame] | 570 | /* Neither of these functions NUL-terminate the buffer */ |
Bram Moolenaar | e4f25e4 | 2017-07-07 11:54:15 +0200 | [diff] [blame] | 571 | size_t vterm_screen_get_chars(const VTermScreen *screen, uint32_t *chars, size_t len, const VTermRect rect); |
| 572 | size_t vterm_screen_get_text(const VTermScreen *screen, char *str, size_t len, const VTermRect rect); |
| 573 | |
| 574 | typedef enum { |
| 575 | VTERM_ATTR_BOLD_MASK = 1 << 0, |
| 576 | VTERM_ATTR_UNDERLINE_MASK = 1 << 1, |
| 577 | VTERM_ATTR_ITALIC_MASK = 1 << 2, |
| 578 | VTERM_ATTR_BLINK_MASK = 1 << 3, |
| 579 | VTERM_ATTR_REVERSE_MASK = 1 << 4, |
| 580 | VTERM_ATTR_STRIKE_MASK = 1 << 5, |
| 581 | VTERM_ATTR_FONT_MASK = 1 << 6, |
| 582 | VTERM_ATTR_FOREGROUND_MASK = 1 << 7, |
Bram Moolenaar | b5b49a3 | 2018-03-25 16:20:37 +0200 | [diff] [blame] | 583 | VTERM_ATTR_BACKGROUND_MASK = 1 << 8, |
Bram Moolenaar | d863728 | 2020-05-20 18:41:41 +0200 | [diff] [blame] | 584 | VTERM_ATTR_CONCEAL_MASK = 1 << 9, |
Bram Moolenaar | b5b49a3 | 2018-03-25 16:20:37 +0200 | [diff] [blame] | 585 | |
Bram Moolenaar | d863728 | 2020-05-20 18:41:41 +0200 | [diff] [blame] | 586 | VTERM_ALL_ATTRS_MASK = (1 << 10) - 1 |
Bram Moolenaar | e4f25e4 | 2017-07-07 11:54:15 +0200 | [diff] [blame] | 587 | } VTermAttrMask; |
| 588 | |
| 589 | int vterm_screen_get_attrs_extent(const VTermScreen *screen, VTermRect *extent, VTermPos pos, VTermAttrMask attrs); |
| 590 | |
| 591 | int vterm_screen_get_cell(const VTermScreen *screen, VTermPos pos, VTermScreenCell *cell); |
| 592 | |
| 593 | int vterm_screen_is_eol(const VTermScreen *screen, VTermPos pos); |
| 594 | |
Bram Moolenaar | e5886cc | 2020-05-21 20:10:04 +0200 | [diff] [blame] | 595 | /** |
| 596 | * Same as vterm_state_convert_color_to_rgb(), but takes a `screen` instead of a `state` |
| 597 | * instance. |
| 598 | */ |
| 599 | void vterm_screen_convert_color_to_rgb(const VTermScreen *screen, VTermColor *col); |
| 600 | |
Bram Moolenaar | b691de0 | 2018-04-24 18:39:14 +0200 | [diff] [blame] | 601 | // --------- |
| 602 | // Utilities |
| 603 | // --------- |
Bram Moolenaar | e4f25e4 | 2017-07-07 11:54:15 +0200 | [diff] [blame] | 604 | |
| 605 | VTermValueType vterm_get_attr_type(VTermAttr attr); |
| 606 | VTermValueType vterm_get_prop_type(VTermProp prop); |
| 607 | |
| 608 | void vterm_scroll_rect(VTermRect rect, |
| 609 | int downward, |
| 610 | int rightward, |
| 611 | int (*moverect)(VTermRect src, VTermRect dest, void *user), |
| 612 | int (*eraserect)(VTermRect rect, int selective, void *user), |
| 613 | void *user); |
| 614 | |
| 615 | void vterm_copy_cells(VTermRect dest, |
| 616 | VTermRect src, |
| 617 | void (*copycell)(VTermPos dest, VTermPos src, void *user), |
| 618 | void *user); |
| 619 | |
| 620 | #ifdef __cplusplus |
| 621 | } |
| 622 | #endif |
| 623 | |
| 624 | #endif |