forked from martanne/vis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwindow.h
47 lines (39 loc) · 1.39 KB
/
window.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#ifndef EDITOR_H
#define EDITOR_H
#include <curses.h>
#include "text.h"
typedef struct Syntax Syntax;
typedef struct Win Win;
typedef size_t Filepos;
Win *window_new(Text*);
void window_free(Win*);
/* keyboard input at cursor position */
size_t window_insert_key(Win*, const char *c, size_t len);
size_t window_replace_key(Win*, const char *c, size_t len);
size_t window_backspace_key(Win*);
size_t window_delete_key(Win*);
bool window_resize(Win*, int width, int height);
void window_move(Win*, int x, int y);
void window_draw(Win*);
/* flush all changes made to the ncurses windows to the screen */
void window_update(Win*);
/* cursor movements, also updates selection if one is active, returns new cursor postion */
size_t window_page_down(Win*);
size_t window_page_up(Win*);
size_t window_char_next(Win*);
size_t window_char_prev(Win*);
size_t window_line_down(Win*);
size_t window_line_up(Win*);
size_t window_cursor_get(Win*);
void window_cursor_getxy(Win*, size_t *lineno, size_t *col);
void window_scroll_to(Win*, size_t pos);
void window_cursor_to(Win*, size_t pos);
void window_selection_start(Win*);
void window_selection_end(Win*);
Filerange window_selection_get(Win*);
void window_selection_clear(Win*);
Filerange window_viewport_get(Win*);
void window_syntax_set(Win*, Syntax*);
Syntax *window_syntax_get(Win*);
void window_cursor_watch(Win *win, void (*cursor_moved)(Win*, void*), void *data);
#endif