Эх сурвалжийг харах

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.
vurtun 9 жил өмнө
parent
commit
bc8db2e3f3
1 өөрчлөгдсөн 2 нэмэгдсэн , 1 устгасан
  1. 2 1
      nuklear.h

+ 2 - 1
nuklear.h

@@ -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;