libghostty
Loading...
Searching...
No Matches
selection.h
Go to the documentation of this file.
1
6
7#ifndef GHOSTTY_VT_SELECTION_H
8#define GHOSTTY_VT_SELECTION_H
9
10#include <stdbool.h>
11#include <stddef.h>
12#include <stdint.h>
14#include <ghostty/vt/grid_ref.h>
15#include <ghostty/vt/point.h>
16#include <ghostty/vt/types.h>
17
18#ifdef __cplusplus
19extern "C" {
20#endif
21
51
61typedef struct GhosttySelectionGestureImpl* GhosttySelectionGesture;
62
71typedef struct GhosttySelectionGestureEventImpl* GhosttySelectionGestureEvent;
72
92typedef struct {
94 size_t size;
95
103
111
118
129typedef struct {
133
135 size_t cap;
136
139 size_t len;
141
152typedef struct {
154 size_t size;
155
158
160 const uint32_t* boundary_codepoints;
161
165
176typedef struct {
178 size_t size;
179
182
185
187 const uint32_t* boundary_codepoints;
188
192
203typedef struct {
205 size_t size;
206
209
211 const uint32_t* whitespace;
212
215
219
235typedef struct {
237 size_t size;
238
241
243 bool unwrap;
244
246 bool trim;
247
259
269typedef enum GHOSTTY_ENUM_TYPED {
272
275
278
281
282 GHOSTTY_SELECTION_ORDER_MAX_VALUE = GHOSTTY_ENUM_MAX_VALUE,
284
294typedef enum GHOSTTY_ENUM_TYPED {
297
300
306
312
315
318
324
330
333
336
337 GHOSTTY_SELECTION_ADJUST_MAX_VALUE = GHOSTTY_ENUM_MAX_VALUE,
339
345typedef enum GHOSTTY_ENUM_TYPED {
348
351
354
357
358 GHOSTTY_SELECTION_GESTURE_BEHAVIOR_MAX_VALUE = GHOSTTY_ENUM_MAX_VALUE,
360
366typedef struct {
369
372
376
382typedef struct {
384 uint32_t columns;
385
387 uint32_t cell_width;
388
390 uint32_t padding_left;
391
395
401typedef enum GHOSTTY_ENUM_TYPED {
404
407
410
411 GHOSTTY_SELECTION_GESTURE_AUTOSCROLL_MAX_VALUE = GHOSTTY_ENUM_MAX_VALUE,
413
420typedef enum GHOSTTY_ENUM_TYPED {
423
426
429
432
441
442 GHOSTTY_SELECTION_GESTURE_DATA_MAX_VALUE = GHOSTTY_ENUM_MAX_VALUE,
444
453typedef enum GHOSTTY_ENUM_TYPED {
456
459
462
465
468
469 GHOSTTY_SELECTION_GESTURE_EVENT_TYPE_MAX_VALUE = GHOSTTY_ENUM_MAX_VALUE,
471
480typedef enum GHOSTTY_ENUM_TYPED {
488
495
498
506
509
519
526
529
532
535
536 GHOSTTY_SELECTION_GESTURE_EVENT_OPT_MAX_VALUE = GHOSTTY_ENUM_MAX_VALUE,
538
551 const GhosttyAllocator* allocator,
554
566
585 const void* value);
586
634 GhosttyTerminal terminal,
636 GhosttySelection* out_selection);
637
653 const GhosttyAllocator* allocator,
654 GhosttySelectionGesture* out_gesture);
655
678 GhosttyTerminal terminal);
679
694 GhosttyTerminal terminal);
695
716 GhosttyTerminal terminal,
718 void* value);
719
745 GhosttyTerminal terminal,
746 size_t count,
747 const GhosttySelectionGestureData* keys,
748 void** values,
749 size_t* out_written);
750
768 GhosttyTerminal terminal,
770 GhosttySelection* out_selection);
771
802 GhosttyTerminal terminal,
804 GhosttySelection* out_selection);
805
823 GhosttyTerminal terminal,
825 GhosttySelection* out_selection);
826
842 GhosttyTerminal terminal,
843 GhosttySelection* out_selection);
844
861 GhosttyTerminal terminal,
862 GhosttyGridRef ref,
863 GhosttySelection* out_selection);
864
894 GhosttyTerminal terminal,
896 uint8_t* buf,
897 size_t buf_len,
898 size_t* out_written);
899
927 GhosttyTerminal terminal,
928 const GhosttyAllocator* allocator,
930 uint8_t** out_ptr,
931 size_t* out_len);
932
959 GhosttyTerminal terminal,
960 GhosttySelection* selection,
961 GhosttySelectionAdjust adjustment);
962
983 GhosttyTerminal terminal,
984 const GhosttySelection* selection,
985 GhosttySelectionOrder* out_order);
986
1014 GhosttyTerminal terminal,
1015 const GhosttySelection* selection,
1016 GhosttySelectionOrder desired,
1017 GhosttySelection* out_selection);
1018
1043 GhosttyTerminal terminal,
1044 const GhosttySelection* selection,
1045 GhosttyPoint point,
1046 bool* out_contains);
1047
1073 GhosttyTerminal terminal,
1074 const GhosttySelection* a,
1075 const GhosttySelection* b,
1076 bool* out_equal);
1077
1079
1080#ifdef __cplusplus
1081}
1082#endif
1083
1084#endif /* GHOSTTY_VT_SELECTION_H */
GhosttyFormatterFormat
Definition types.h:248
GhosttySelectionOrder
Definition selection.h:269
GHOSTTY_API GhosttyResult ghostty_selection_gesture_event_new(const GhosttyAllocator *allocator, GhosttySelectionGestureEvent *out_event, GhosttySelectionGestureEventType type)
GhosttySelectionGestureBehavior
Definition selection.h:345
struct GhosttySelectionGestureImpl * GhosttySelectionGesture
Definition selection.h:61
GHOSTTY_API GhosttyResult ghostty_terminal_selection_equal(GhosttyTerminal terminal, const GhosttySelection *a, const GhosttySelection *b, bool *out_equal)
GHOSTTY_API GhosttyResult ghostty_selection_gesture_event(GhosttySelectionGesture gesture, GhosttyTerminal terminal, GhosttySelectionGestureEvent event, GhosttySelection *out_selection)
GHOSTTY_API GhosttyResult ghostty_terminal_select_all(GhosttyTerminal terminal, GhosttySelection *out_selection)
GHOSTTY_API GhosttyResult ghostty_selection_gesture_get(GhosttySelectionGesture gesture, GhosttyTerminal terminal, GhosttySelectionGestureData data, void *value)
GHOSTTY_API GhosttyResult ghostty_selection_gesture_get_multi(GhosttySelectionGesture gesture, GhosttyTerminal terminal, size_t count, const GhosttySelectionGestureData *keys, void **values, size_t *out_written)
GHOSTTY_API GhosttyResult ghostty_terminal_selection_format_buf(GhosttyTerminal terminal, GhosttyTerminalSelectionFormatOptions options, uint8_t *buf, size_t buf_len, size_t *out_written)
GHOSTTY_API GhosttyResult ghostty_terminal_select_output(GhosttyTerminal terminal, GhosttyGridRef ref, GhosttySelection *out_selection)
GhosttySelectionGestureAutoscroll
Definition selection.h:401
GHOSTTY_API GhosttyResult ghostty_terminal_selection_order(GhosttyTerminal terminal, const GhosttySelection *selection, GhosttySelectionOrder *out_order)
struct GhosttySelectionGestureEventImpl * GhosttySelectionGestureEvent
Definition selection.h:71
GHOSTTY_API GhosttyResult ghostty_selection_gesture_event_set(GhosttySelectionGestureEvent event, GhosttySelectionGestureEventOption option, const void *value)
GhosttySelectionGestureData
Definition selection.h:420
GHOSTTY_API GhosttyResult ghostty_terminal_selection_contains(GhosttyTerminal terminal, const GhosttySelection *selection, GhosttyPoint point, bool *out_contains)
GhosttySelectionAdjust
Definition selection.h:294
GHOSTTY_API void ghostty_selection_gesture_event_free(GhosttySelectionGestureEvent event)
GHOSTTY_API GhosttyResult ghostty_terminal_select_word_between(GhosttyTerminal terminal, const GhosttyTerminalSelectWordBetweenOptions *options, GhosttySelection *out_selection)
GHOSTTY_API GhosttyResult ghostty_terminal_selection_format_alloc(GhosttyTerminal terminal, const GhosttyAllocator *allocator, GhosttyTerminalSelectionFormatOptions options, uint8_t **out_ptr, size_t *out_len)
GHOSTTY_API GhosttyResult ghostty_terminal_select_line(GhosttyTerminal terminal, const GhosttyTerminalSelectLineOptions *options, GhosttySelection *out_selection)
GHOSTTY_API GhosttyResult ghostty_selection_gesture_new(const GhosttyAllocator *allocator, GhosttySelectionGesture *out_gesture)
GHOSTTY_API void ghostty_selection_gesture_reset(GhosttySelectionGesture gesture, GhosttyTerminal terminal)
GHOSTTY_API GhosttyResult ghostty_terminal_selection_ordered(GhosttyTerminal terminal, const GhosttySelection *selection, GhosttySelectionOrder desired, GhosttySelection *out_selection)
GHOSTTY_API GhosttyResult ghostty_terminal_selection_adjust(GhosttyTerminal terminal, GhosttySelection *selection, GhosttySelectionAdjust adjustment)
GHOSTTY_API GhosttyResult ghostty_terminal_select_word(GhosttyTerminal terminal, const GhosttyTerminalSelectWordOptions *options, GhosttySelection *out_selection)
GhosttySelectionGestureEventOption
Definition selection.h:480
GHOSTTY_API void ghostty_selection_gesture_free(GhosttySelectionGesture gesture, GhosttyTerminal terminal)
GhosttySelectionGestureEventType
Definition selection.h:453
@ GHOSTTY_SELECTION_ORDER_MIRRORED_FORWARD
Definition selection.h:277
@ GHOSTTY_SELECTION_ORDER_MIRRORED_REVERSE
Definition selection.h:280
@ GHOSTTY_SELECTION_ORDER_FORWARD
Definition selection.h:271
@ GHOSTTY_SELECTION_ORDER_REVERSE
Definition selection.h:274
@ GHOSTTY_SELECTION_GESTURE_BEHAVIOR_OUTPUT
Definition selection.h:356
@ GHOSTTY_SELECTION_GESTURE_BEHAVIOR_CELL
Definition selection.h:347
@ GHOSTTY_SELECTION_GESTURE_BEHAVIOR_WORD
Definition selection.h:350
@ GHOSTTY_SELECTION_GESTURE_BEHAVIOR_LINE
Definition selection.h:353
@ GHOSTTY_SELECTION_GESTURE_AUTOSCROLL_NONE
Definition selection.h:403
@ GHOSTTY_SELECTION_GESTURE_AUTOSCROLL_DOWN
Definition selection.h:409
@ GHOSTTY_SELECTION_GESTURE_AUTOSCROLL_UP
Definition selection.h:406
@ GHOSTTY_SELECTION_GESTURE_DATA_DRAGGED
Definition selection.h:425
@ GHOSTTY_SELECTION_GESTURE_DATA_AUTOSCROLL
Definition selection.h:428
@ GHOSTTY_SELECTION_GESTURE_DATA_BEHAVIOR
Definition selection.h:431
@ GHOSTTY_SELECTION_GESTURE_DATA_CLICK_COUNT
Definition selection.h:422
@ GHOSTTY_SELECTION_GESTURE_DATA_ANCHOR
Definition selection.h:440
@ GHOSTTY_SELECTION_ADJUST_END_OF_LINE
Definition selection.h:335
@ GHOSTTY_SELECTION_ADJUST_LEFT
Definition selection.h:296
@ GHOSTTY_SELECTION_ADJUST_BEGINNING_OF_LINE
Definition selection.h:332
@ GHOSTTY_SELECTION_ADJUST_PAGE_UP
Definition selection.h:323
@ GHOSTTY_SELECTION_ADJUST_PAGE_DOWN
Definition selection.h:329
@ GHOSTTY_SELECTION_ADJUST_UP
Definition selection.h:305
@ GHOSTTY_SELECTION_ADJUST_HOME
Definition selection.h:314
@ GHOSTTY_SELECTION_ADJUST_END
Definition selection.h:317
@ GHOSTTY_SELECTION_ADJUST_RIGHT
Definition selection.h:299
@ GHOSTTY_SELECTION_ADJUST_DOWN
Definition selection.h:311
@ GHOSTTY_SELECTION_GESTURE_EVENT_OPT_WORD_BOUNDARY_CODEPOINTS
Definition selection.h:518
@ GHOSTTY_SELECTION_GESTURE_EVENT_OPT_REPEAT_DISTANCE
Definition selection.h:497
@ GHOSTTY_SELECTION_GESTURE_EVENT_OPT_REPEAT_INTERVAL_NS
Definition selection.h:508
@ GHOSTTY_SELECTION_GESTURE_EVENT_OPT_GEOMETRY
Definition selection.h:531
@ GHOSTTY_SELECTION_GESTURE_EVENT_OPT_TIME_NS
Definition selection.h:505
@ GHOSTTY_SELECTION_GESTURE_EVENT_OPT_REF
Definition selection.h:487
@ GHOSTTY_SELECTION_GESTURE_EVENT_OPT_RECTANGLE
Definition selection.h:528
@ GHOSTTY_SELECTION_GESTURE_EVENT_OPT_BEHAVIORS
Definition selection.h:525
@ GHOSTTY_SELECTION_GESTURE_EVENT_OPT_POSITION
Definition selection.h:494
@ GHOSTTY_SELECTION_GESTURE_EVENT_OPT_VIEWPORT
Definition selection.h:534
@ GHOSTTY_SELECTION_GESTURE_EVENT_TYPE_PRESS
Definition selection.h:455
@ GHOSTTY_SELECTION_GESTURE_EVENT_TYPE_AUTOSCROLL_TICK
Definition selection.h:464
@ GHOSTTY_SELECTION_GESTURE_EVENT_TYPE_DEEP_PRESS
Definition selection.h:467
@ GHOSTTY_SELECTION_GESTURE_EVENT_TYPE_RELEASE
Definition selection.h:458
@ GHOSTTY_SELECTION_GESTURE_EVENT_TYPE_DRAG
Definition selection.h:461
struct GhosttyTerminalImpl * GhosttyTerminal
Definition types.h:119
GhosttySelection * ptr
Definition selection.h:132
GhosttySelectionGestureBehavior triple_click
Definition selection.h:374
GhosttySelectionGestureBehavior double_click
Definition selection.h:371
GhosttySelectionGestureBehavior single_click
Definition selection.h:368
GhosttyGridRef end
Definition selection.h:110
GhosttyGridRef start
Definition selection.h:102
const uint32_t * boundary_codepoints
Definition selection.h:160
const GhosttySelection * selection
Definition selection.h:257
GhosttyResult
Definition types.h:88
#define GHOSTTY_ENUM_TYPED
Definition types.h:81