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_LINENUMBER_CURSOR
,
45 UI_STYLE_COLOR_COLUMN
,
47 UI_STYLE_STATUS_FOCUSED
,
55 typedef uint64_t CellAttr
;
56 typedef short CellColor
;
58 static inline bool cell_color_equal(CellColor c1
, CellColor c2
) {
62 typedef uint8_t CellAttr
;
68 static inline bool cell_color_equal(CellColor c1
, CellColor c2
) {
69 if (c1
.index
!= (uint8_t)-1 || c2
.index
!= (uint8_t)-1)
70 return c1
.index
== c2
.index
;
71 return c1
.r
== c2
.r
&& c1
.g
== c2
.g
&& c1
.b
== c2
.b
;
86 bool (*init
)(Ui
*, Vis
*);
89 UiWin
* (*window_new
)(Ui
*, Win
*, enum UiOption
);
90 void (*window_free
)(UiWin
*);
91 void (*window_focus
)(UiWin
*);
92 void (*window_swap
)(UiWin
*, UiWin
*);
93 void (*die
)(Ui
*, const char *msg
, va_list ap
) __attribute__((noreturn
));
94 void (*info
)(Ui
*, const char *msg
, va_list ap
);
95 void (*info_hide
)(Ui
*);
96 void (*arrange
)(Ui
*, enum UiLayout
);
101 bool (*getkey
)(Ui
*, TermKeyKey
*);
102 void (*terminal_save
)(Ui
*);
103 void (*terminal_restore
)(Ui
*);
104 TermKey
* (*termkey_get
)(Ui
*);
109 CellStyle (*style_get
)(UiWin
*, enum UiStyle
);
110 void (*status
)(UiWin
*, const char *txt
);
111 void (*options_set
)(UiWin
*, enum UiOption
);
112 enum UiOption (*options_get
)(UiWin
*);
113 bool (*style_define
)(UiWin
*, int id
, const char *style
);
114 int (*window_width
)(UiWin
*);
115 int (*window_height
)(UiWin
*);
118 bool is_default_color(CellColor c
);