]> git.ipfire.org Git - thirdparty/util-linux.git/blame - include/mbsedit.h
Merge branch 'ci/meson-werror' of https://github.com/t-8ch/util-linux
[thirdparty/util-linux.git] / include / mbsedit.h
CommitLineData
faeb1b64
KZ
1/*
2 * SPDX-License-Identifier: LGPL-2.1-or-later
3 *
4 * This file may be distributed under the terms of the
5 * GNU Lesser General Public License.
6 */
299ef2c4
KZ
7#ifndef UTIL_LINUX_MBSEDIT_H
8# define UTIL_LINUX_MBSEDIT_H
9
10#include "mbsalign.h"
11#include "widechar.h"
12
13struct mbs_editor {
14 char *buf; /* buffer */
15 size_t max_bytes; /* size of the buffer */
16 size_t max_cells; /* maximal allowed number of cells */
17 size_t cur_cells; /* number of cells to print the buffer */
18 size_t cur_bytes; /* number of chars in bytes */
19 size_t cursor; /* cursor position in bytes */
20 size_t cursor_cells; /* cursor position in cells */
21};
22
23enum {
24 MBS_EDIT_LEFT,
25 MBS_EDIT_RIGHT,
26 MBS_EDIT_END,
27 MBS_EDIT_HOME
28};
29
30struct mbs_editor *mbs_new_edit(char *buf, size_t bufsz, size_t ncells);
31char *mbs_free_edit(struct mbs_editor *edit);
32
33int mbs_edit_goto(struct mbs_editor *edit, int where);
34int mbs_edit_delete(struct mbs_editor *edit);
35int mbs_edit_backspace(struct mbs_editor *edit);
36int mbs_edit_insert(struct mbs_editor *edit, wint_t c);
37
38#endif /* UTIL_LINUX_MBSEDIT_H */