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
250 bool trim;
251
263
273typedef enum GHOSTTY_ENUM_TYPED {
276
279
282
285
286 GHOSTTY_SELECTION_ORDER_MAX_VALUE = GHOSTTY_ENUM_MAX_VALUE,
288
298typedef enum GHOSTTY_ENUM_TYPED {
301
304
310
316
319
322
328
334
337
340
341 GHOSTTY_SELECTION_ADJUST_MAX_VALUE = GHOSTTY_ENUM_MAX_VALUE,
343
349typedef enum GHOSTTY_ENUM_TYPED {
352
355
358
361
362 GHOSTTY_SELECTION_GESTURE_BEHAVIOR_MAX_VALUE = GHOSTTY_ENUM_MAX_VALUE,
364
370typedef struct {
373
376
380
386typedef struct {
388 uint32_t columns;
389
391 uint32_t cell_width;
392
394 uint32_t padding_left;
395
399
405typedef enum GHOSTTY_ENUM_TYPED {
408
411
414
415 GHOSTTY_SELECTION_GESTURE_AUTOSCROLL_MAX_VALUE = GHOSTTY_ENUM_MAX_VALUE,
417
424typedef enum GHOSTTY_ENUM_TYPED {
427
430
433
436
445
446 GHOSTTY_SELECTION_GESTURE_DATA_MAX_VALUE = GHOSTTY_ENUM_MAX_VALUE,
448
457typedef enum GHOSTTY_ENUM_TYPED {
460
463
466
469
472
473 GHOSTTY_SELECTION_GESTURE_EVENT_TYPE_MAX_VALUE = GHOSTTY_ENUM_MAX_VALUE,
475
484typedef enum GHOSTTY_ENUM_TYPED {
492
499
502
510
513
523
530
533
536
539
540 GHOSTTY_SELECTION_GESTURE_EVENT_OPT_MAX_VALUE = GHOSTTY_ENUM_MAX_VALUE,
542
555 const GhosttyAllocator* allocator,
558
570
589 const void* value);
590
638 GhosttyTerminal terminal,
640 GhosttySelection* out_selection);
641
657 const GhosttyAllocator* allocator,
658 GhosttySelectionGesture* out_gesture);
659
682 GhosttyTerminal terminal);
683
698 GhosttyTerminal terminal);
699
720 GhosttyTerminal terminal,
722 void* value);
723
749 GhosttyTerminal terminal,
750 size_t count,
751 const GhosttySelectionGestureData* keys,
752 void** values,
753 size_t* out_written);
754
772 GhosttyTerminal terminal,
774 GhosttySelection* out_selection);
775
806 GhosttyTerminal terminal,
808 GhosttySelection* out_selection);
809
827 GhosttyTerminal terminal,
829 GhosttySelection* out_selection);
830
846 GhosttyTerminal terminal,
847 GhosttySelection* out_selection);
848
865 GhosttyTerminal terminal,
866 GhosttyGridRef ref,
867 GhosttySelection* out_selection);
868
898 GhosttyTerminal terminal,
900 uint8_t* buf,
901 size_t buf_len,
902 size_t* out_written);
903
933 GhosttyTerminal terminal,
934 const GhosttyAllocator* allocator,
936 uint8_t** out_ptr,
937 size_t* out_len);
938
965 GhosttyTerminal terminal,
966 GhosttySelection* selection,
967 GhosttySelectionAdjust adjustment);
968
989 GhosttyTerminal terminal,
990 const GhosttySelection* selection,
991 GhosttySelectionOrder* out_order);
992
1020 GhosttyTerminal terminal,
1021 const GhosttySelection* selection,
1022 GhosttySelectionOrder desired,
1023 GhosttySelection* out_selection);
1024
1049 GhosttyTerminal terminal,
1050 const GhosttySelection* selection,
1051 GhosttyPoint point,
1052 bool* out_contains);
1053
1079 GhosttyTerminal terminal,
1080 const GhosttySelection* a,
1081 const GhosttySelection* b,
1082 bool* out_equal);
1083
1085
1086#ifdef __cplusplus
1087}
1088#endif
1089
1090#endif /* GHOSTTY_VT_SELECTION_H */
GhosttyFormatterFormat
Definition types.h:256
GhosttySelectionOrder
Definition selection.h:273
GHOSTTY_API GhosttyResult ghostty_selection_gesture_event_new(const GhosttyAllocator *allocator, GhosttySelectionGestureEvent *out_event, GhosttySelectionGestureEventType type)
GhosttySelectionGestureBehavior
Definition selection.h:349
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:405
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:424
GHOSTTY_API GhosttyResult ghostty_terminal_selection_contains(GhosttyTerminal terminal, const GhosttySelection *selection, GhosttyPoint point, bool *out_contains)
GhosttySelectionAdjust
Definition selection.h:298
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:484
GHOSTTY_API void ghostty_selection_gesture_free(GhosttySelectionGesture gesture, GhosttyTerminal terminal)
GhosttySelectionGestureEventType
Definition selection.h:457
@ GHOSTTY_SELECTION_ORDER_MIRRORED_FORWARD
Definition selection.h:281
@ GHOSTTY_SELECTION_ORDER_MIRRORED_REVERSE
Definition selection.h:284
@ GHOSTTY_SELECTION_ORDER_FORWARD
Definition selection.h:275
@ GHOSTTY_SELECTION_ORDER_REVERSE
Definition selection.h:278
@ GHOSTTY_SELECTION_GESTURE_BEHAVIOR_OUTPUT
Definition selection.h:360
@ GHOSTTY_SELECTION_GESTURE_BEHAVIOR_CELL
Definition selection.h:351
@ GHOSTTY_SELECTION_GESTURE_BEHAVIOR_WORD
Definition selection.h:354
@ GHOSTTY_SELECTION_GESTURE_BEHAVIOR_LINE
Definition selection.h:357
@ GHOSTTY_SELECTION_GESTURE_AUTOSCROLL_NONE
Definition selection.h:407
@ GHOSTTY_SELECTION_GESTURE_AUTOSCROLL_DOWN
Definition selection.h:413
@ GHOSTTY_SELECTION_GESTURE_AUTOSCROLL_UP
Definition selection.h:410
@ GHOSTTY_SELECTION_GESTURE_DATA_DRAGGED
Definition selection.h:429
@ GHOSTTY_SELECTION_GESTURE_DATA_AUTOSCROLL
Definition selection.h:432
@ GHOSTTY_SELECTION_GESTURE_DATA_BEHAVIOR
Definition selection.h:435
@ GHOSTTY_SELECTION_GESTURE_DATA_CLICK_COUNT
Definition selection.h:426
@ GHOSTTY_SELECTION_GESTURE_DATA_ANCHOR
Definition selection.h:444
@ GHOSTTY_SELECTION_ADJUST_END_OF_LINE
Definition selection.h:339
@ GHOSTTY_SELECTION_ADJUST_LEFT
Definition selection.h:300
@ GHOSTTY_SELECTION_ADJUST_BEGINNING_OF_LINE
Definition selection.h:336
@ GHOSTTY_SELECTION_ADJUST_PAGE_UP
Definition selection.h:327
@ GHOSTTY_SELECTION_ADJUST_PAGE_DOWN
Definition selection.h:333
@ GHOSTTY_SELECTION_ADJUST_UP
Definition selection.h:309
@ GHOSTTY_SELECTION_ADJUST_HOME
Definition selection.h:318
@ GHOSTTY_SELECTION_ADJUST_END
Definition selection.h:321
@ GHOSTTY_SELECTION_ADJUST_RIGHT
Definition selection.h:303
@ GHOSTTY_SELECTION_ADJUST_DOWN
Definition selection.h:315
@ GHOSTTY_SELECTION_GESTURE_EVENT_OPT_WORD_BOUNDARY_CODEPOINTS
Definition selection.h:522
@ GHOSTTY_SELECTION_GESTURE_EVENT_OPT_REPEAT_DISTANCE
Definition selection.h:501
@ GHOSTTY_SELECTION_GESTURE_EVENT_OPT_REPEAT_INTERVAL_NS
Definition selection.h:512
@ GHOSTTY_SELECTION_GESTURE_EVENT_OPT_GEOMETRY
Definition selection.h:535
@ GHOSTTY_SELECTION_GESTURE_EVENT_OPT_TIME_NS
Definition selection.h:509
@ GHOSTTY_SELECTION_GESTURE_EVENT_OPT_REF
Definition selection.h:491
@ GHOSTTY_SELECTION_GESTURE_EVENT_OPT_RECTANGLE
Definition selection.h:532
@ GHOSTTY_SELECTION_GESTURE_EVENT_OPT_BEHAVIORS
Definition selection.h:529
@ GHOSTTY_SELECTION_GESTURE_EVENT_OPT_POSITION
Definition selection.h:498
@ GHOSTTY_SELECTION_GESTURE_EVENT_OPT_VIEWPORT
Definition selection.h:538
@ GHOSTTY_SELECTION_GESTURE_EVENT_TYPE_PRESS
Definition selection.h:459
@ GHOSTTY_SELECTION_GESTURE_EVENT_TYPE_AUTOSCROLL_TICK
Definition selection.h:468
@ GHOSTTY_SELECTION_GESTURE_EVENT_TYPE_DEEP_PRESS
Definition selection.h:471
@ GHOSTTY_SELECTION_GESTURE_EVENT_TYPE_RELEASE
Definition selection.h:462
@ GHOSTTY_SELECTION_GESTURE_EVENT_TYPE_DRAG
Definition selection.h:465
struct GhosttyTerminalImpl * GhosttyTerminal
Definition types.h:119
GhosttySelection * ptr
Definition selection.h:132
GhosttySelectionGestureBehavior triple_click
Definition selection.h:378
GhosttySelectionGestureBehavior double_click
Definition selection.h:375
GhosttySelectionGestureBehavior single_click
Definition selection.h:372
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:261
GhosttyResult
Definition types.h:88
#define GHOSTTY_ENUM_TYPED
Definition types.h:81