8 /* enable large file optimization for files larger than: */
9 #define UI_LARGE_FILE_SIZE (1 << 25)
10 /* enable large file optimization fo files containing lines longer than: */
11 #define UI_LARGE_FILE_LINE_SIZE (1 << 16)
14 typedef struct UiWin UiWin
;
23 UI_OPTION_LINE_NUMBERS_ABSOLUTE
= 1 << 0,
24 UI_OPTION_LINE_NUMBERS_RELATIVE
= 1 << 1,
25 UI_OPTION_SYMBOL_SPACE
= 1 << 2,
26 UI_OPTION_SYMBOL_TAB
= 1 << 3,
27 UI_OPTION_SYMBOL_TAB_FILL
= 1 << 4,
28 UI_OPTION_SYMBOL_EOL
= 1 << 5,
29 UI_OPTION_SYMBOL_EOF
= 1 << 6,
30 UI_OPTION_CURSOR_LINE
= 1 << 7,
31 UI_OPTION_STATUSBAR
= 1 << 8,
32 UI_OPTION_ONELINE
= 1 << 9,
33 UI_OPTION_LARGE_FILE
= 1 << 10,
37 UI_STYLE_LEXER_MAX
= 64,
40 UI_STYLE_CURSOR_PRIMARY
,
44 UI_STYLE_COLOR_COLUMN
,
46 UI_STYLE_STATUS_FOCUSED
,
54 typedef uint64_t CellAttr
;
55 typedef short CellColor
;
57 static inline bool cell_color_equal(CellColor c1
, CellColor c2
) {
61 typedef uint8_t CellAttr
;
67 static inline bool cell_color_equal(CellColor c1
, CellColor c2
) {
68 if (c1
.index
!= (uint8_t)-1 || c2
.index
!= (uint8_t)-1)
69 return c1
.index
== c2
.index
;
70 return c1
.r
== c2
.r
&& c1
.g
== c2
.g
&& c1
.b
== c2
.b
;
85 bool (*init
)(Ui
*, Vis
*);
88 UiWin
* (*window_new
)(Ui
*, Win
*, enum UiOption
);
89 void (*window_free
)(UiWin
*);
90 void (*window_focus
)(UiWin
*);
91 void (*window_swap
)(UiWin
*, UiWin
*);
92 void (*die
)(Ui
*, const char *msg
, va_list ap
) __attribute__((noreturn
));
93 void (*info
)(Ui
*, const char *msg
, va_list ap
);
94 void (*info_hide
)(Ui
*);
95 void (*arrange
)(Ui
*, enum UiLayout
);
100 bool (*getkey
)(Ui
*, TermKeyKey
*);
101 void (*terminal_save
)(Ui
*);
102 void (*terminal_restore
)(Ui
*);
103 TermKey
* (*termkey_get
)(Ui
*);
108 CellStyle (*style_get
)(UiWin
*, enum UiStyle
);
109 void (*status
)(UiWin
*, const char *txt
);
110 void (*options_set
)(UiWin
*, enum UiOption
);
111 enum UiOption (*options_get
)(UiWin
*);
112 bool (*style_define
)(UiWin
*, int id
, const char *style
);
113 int (*window_width
)(UiWin
*);
114 int (*window_height
)(UiWin
*);