fixed editbox glyph removing
This commit is contained in:
parent
50e3f4deec
commit
ca212ed1ab
15
gui.c
15
gui.c
@ -896,8 +896,21 @@ gui_edit_box_buffer_input(struct gui_edit_box *box, const struct gui_input *i)
|
|||||||
void
|
void
|
||||||
gui_edit_box_remove(struct gui_edit_box *eb)
|
gui_edit_box_remove(struct gui_edit_box *eb)
|
||||||
{
|
{
|
||||||
|
gui_long unicode;
|
||||||
|
gui_size src_len = 0;
|
||||||
|
gui_size last_glyph = 0;
|
||||||
|
gui_size glyph_len = 0;
|
||||||
|
gui_char *text = gui_edit_box_get(eb);
|
||||||
|
gui_size text_len = gui_edit_box_len(eb);
|
||||||
GUI_ASSERT(eb);
|
GUI_ASSERT(eb);
|
||||||
gui_edit_buffer_remove(&eb->buffer, 1);
|
|
||||||
|
glyph_len = gui_utf_decode(text, &unicode, text_len);
|
||||||
|
while (glyph_len) {
|
||||||
|
src_len = src_len + glyph_len;
|
||||||
|
last_glyph = glyph_len;
|
||||||
|
glyph_len = gui_utf_decode(text + src_len, &unicode, text_len - src_len);
|
||||||
|
}
|
||||||
|
gui_edit_buffer_remove(&eb->buffer, last_glyph);
|
||||||
}
|
}
|
||||||
|
|
||||||
gui_char*
|
gui_char*
|
||||||
|
2
gui.h
2
gui.h
@ -741,7 +741,7 @@ char *gui_edit_buffer_at(gui_edit_buffer*, gui_size pos);
|
|||||||
The Editbox first needs to be initialized either with a fixed size
|
The Editbox first needs to be initialized either with a fixed size
|
||||||
memory block or a allocator. After that it can be used by either the
|
memory block or a allocator. After that it can be used by either the
|
||||||
`gui_editobx` or `gui_panel_editbox` function. In addition symbols can be
|
`gui_editobx` or `gui_panel_editbox` function. In addition symbols can be
|
||||||
added and removed with either `gui_edit_box_add` and `gui_edit_box_remove`.
|
added and removed with `gui_edit_box_add` and `gui_edit_box_remove`.
|
||||||
|
|
||||||
Widget function API
|
Widget function API
|
||||||
gui_edit_box_init() -- initialize a dynamically growing edit box
|
gui_edit_box_init() -- initialize a dynamically growing edit box
|
||||||
|
Loading…
x
Reference in New Issue
Block a user