]>
Commit | Line | Data |
---|---|---|
299ef2c4 KZ |
1 | #ifndef UTIL_LINUX_MBSEDIT_H |
2 | # define UTIL_LINUX_MBSEDIT_H | |
3 | ||
4 | #include "mbsalign.h" | |
5 | #include "widechar.h" | |
6 | ||
7 | struct mbs_editor { | |
8 | char *buf; /* buffer */ | |
9 | size_t max_bytes; /* size of the buffer */ | |
10 | size_t max_cells; /* maximal allowed number of cells */ | |
11 | size_t cur_cells; /* number of cells to print the buffer */ | |
12 | size_t cur_bytes; /* number of chars in bytes */ | |
13 | size_t cursor; /* cursor position in bytes */ | |
14 | size_t cursor_cells; /* cursor position in cells */ | |
15 | }; | |
16 | ||
17 | enum { | |
18 | MBS_EDIT_LEFT, | |
19 | MBS_EDIT_RIGHT, | |
20 | MBS_EDIT_END, | |
21 | MBS_EDIT_HOME | |
22 | }; | |
23 | ||
24 | struct mbs_editor *mbs_new_edit(char *buf, size_t bufsz, size_t ncells); | |
25 | char *mbs_free_edit(struct mbs_editor *edit); | |
26 | ||
27 | int mbs_edit_goto(struct mbs_editor *edit, int where); | |
28 | int mbs_edit_delete(struct mbs_editor *edit); | |
29 | int mbs_edit_backspace(struct mbs_editor *edit); | |
30 | int mbs_edit_insert(struct mbs_editor *edit, wint_t c); | |
31 | ||
32 | #endif /* UTIL_LINUX_MBSEDIT_H */ |