Fixed #97 with text input at end of edit field

This commit fixes a bug that occurs if you move the cursor inside
text and then back to the end of the text and insert a character.
Caused was the bug by an incorrect check if the cursor is at the
end of the string.
This commit is contained in:
vurtun 2016-04-21 12:39:07 +02:00
parent 68d274c094
commit bc8db2e3f3

View File

@ -13087,7 +13087,8 @@ nk_do_edit(nk_flags *state, struct nk_command_buffer *out,
/* cursor */
if (edit->select_start == edit->select_end)
{
if (edit->cursor == nk_str_len(&edit->string) || (cursor_ptr && *cursor_ptr == '\n')) {
if (edit->cursor >= nk_str_len(&edit->string) ||
(cursor_ptr && *cursor_ptr == '\n')) {
/* draw cursor at end of line */
struct nk_rect cursor;
cursor.w = style->cursor_size;