Make f, F, t, T motion work when replaying a macro
[vis.git] / ui.h
blob76de366970c4c0393e45dc4ad48cde58718859b0
1 #ifndef UI_H
2 #define UI_H
4 #include <stdbool.h>
5 #include <stdarg.h>
6 #include <termkey.h>
8 typedef struct Ui Ui;
9 typedef struct UiWin UiWin;
11 enum UiLayout {
12 UI_LAYOUT_HORIZONTAL,
13 UI_LAYOUT_VERTICAL,
16 enum UiOption {
17 UI_OPTION_NONE = 0,
18 UI_OPTION_LINE_NUMBERS_ABSOLUTE = 1 << 0,
19 UI_OPTION_LINE_NUMBERS_RELATIVE = 1 << 1,
20 UI_OPTION_SYMBOL_SPACE = 1 << 2,
21 UI_OPTION_SYMBOL_TAB = 1 << 3,
22 UI_OPTION_SYMBOL_TAB_FILL = 1 << 4,
23 UI_OPTION_SYMBOL_EOL = 1 << 5,
24 UI_OPTION_SYMBOL_EOF = 1 << 6,
25 UI_OPTION_CURSOR_LINE = 1 << 7,
26 UI_OPTION_STATUSBAR = 1 << 8,
27 UI_OPTION_ONELINE = 1 << 9,
28 UI_OPTION_LARGE_FILE = 1 << 10,
31 enum UiStyles {
32 UI_STYLE_LEXER_MAX = 64,
33 UI_STYLE_DEFAULT,
34 UI_STYLE_CURSOR,
35 UI_STYLE_CURSOR_LINE,
36 UI_STYLE_SELECTION,
37 UI_STYLE_LINENUMBER,
38 UI_STYLE_COLOR_COLUMN,
39 UI_STYLE_MAX,
42 #include "vis.h"
43 #include "text.h"
44 #include "view.h"
46 struct Ui {
47 bool (*init)(Ui*, Vis*);
48 bool (*start)(Ui*);
49 void (*free)(Ui*);
50 void (*resize)(Ui*);
51 UiWin* (*window_new)(Ui*, View*, File*, enum UiOption);
52 void (*window_free)(UiWin*);
53 void (*window_focus)(UiWin*);
54 void (*die)(Ui*, const char *msg, va_list ap) __attribute__((noreturn));
55 void (*info)(Ui*, const char *msg, va_list ap);
56 void (*info_hide)(Ui*);
57 void (*arrange)(Ui*, enum UiLayout);
58 void (*draw)(Ui*);
59 void (*redraw)(Ui*);
60 void (*update)(Ui*);
61 void (*suspend)(Ui*);
62 const char* (*getkey)(Ui*);
63 bool (*haskey)(Ui*);
64 void (*terminal_save)(Ui*);
65 void (*terminal_restore)(Ui*);
66 TermKey* (*termkey_get)(Ui*);
69 struct UiWin {
70 void (*draw)(UiWin*);
71 void (*draw_status)(UiWin*);
72 void (*reload)(UiWin*, File*);
73 void (*options_set)(UiWin*, enum UiOption);
74 enum UiOption (*options_get)(UiWin*);
75 bool (*syntax_style)(UiWin*, int id, const char *style);
78 #endif