From 3b5009255e8fdcf13d0e4b7895812f0acd561c0e Mon Sep 17 00:00:00 2001 From: opsJson <54485405+opsJson@users.noreply.github.com> Date: Mon, 25 Jul 2022 20:07:20 -0300 Subject: [PATCH 1/6] Fix Shift + End in nk_edit --- nuklear.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nuklear.h b/nuklear.h index aef8f7f..fde970a 100644 --- a/nuklear.h +++ b/nuklear.h @@ -26423,6 +26423,7 @@ retry: if (shift_mod) { nk_textedit_prep_selection_at_cursor(state); state->cursor = state->select_end = state->string.len; + if (state->select_start >= state->select_end) state->select_start = 0; state->has_preferred_x = 0; } else { state->cursor = state->string.len; @@ -30006,4 +30007,3 @@ nk_tooltipfv(struct nk_context *ctx, const char *fmt, va_list args) /// in libraries and brought me to create some of my own. Finally Apoorva Joshi /// for his single header file packer. */ - From d28d145732a8b9e17a16348a1d86d2174b5b9d96 Mon Sep 17 00:00:00 2001 From: opsJson <54485405+opsJson@users.noreply.github.com> Date: Sat, 30 Jul 2022 21:33:46 -0300 Subject: [PATCH 2/6] Fixed cursor position overflow --- nuklear.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nuklear.h b/nuklear.h index fde970a..377fa6b 100644 --- a/nuklear.h +++ b/nuklear.h @@ -26163,6 +26163,7 @@ nk_textedit_text(struct nk_text_edit *state, const char *text, int total_len) { nk_textedit_makeundo_insert(state, state->cursor, 1); ++state->cursor; + state->cursor = NK_MIN(state->cursor, state->string.len); state->has_preferred_x = 0; } } @@ -26423,7 +26424,6 @@ retry: if (shift_mod) { nk_textedit_prep_selection_at_cursor(state); state->cursor = state->select_end = state->string.len; - if (state->select_start >= state->select_end) state->select_start = 0; state->has_preferred_x = 0; } else { state->cursor = state->string.len; @@ -30007,3 +30007,4 @@ nk_tooltipfv(struct nk_context *ctx, const char *fmt, va_list args) /// in libraries and brought me to create some of my own. Finally Apoorva Joshi /// for his single header file packer. */ + From 9f0a6013954d6fa0ac44307245450f65b22cfb11 Mon Sep 17 00:00:00 2001 From: opsJson <54485405+opsJson@users.noreply.github.com> Date: Sat, 30 Jul 2022 21:36:01 -0300 Subject: [PATCH 3/6] Update nuklear_text_editor.c --- src/nuklear_text_editor.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/nuklear_text_editor.c b/src/nuklear_text_editor.c index 5b0c03a..bd93250 100644 --- a/src/nuklear_text_editor.c +++ b/src/nuklear_text_editor.c @@ -395,6 +395,7 @@ nk_textedit_text(struct nk_text_edit *state, const char *text, int total_len) { nk_textedit_makeundo_insert(state, state->cursor, 1); ++state->cursor; + state->cursor = NK_MIN(state->cursor, state->string.len); state->has_preferred_x = 0; } } From c7c3069dc2e6c070dcbb9c99f3292076dc5a69a0 Mon Sep 17 00:00:00 2001 From: opsJson Date: Mon, 1 Aug 2022 15:33:42 -0300 Subject: [PATCH 4/6] following the read me --- clib.json | 2 +- src/CHANGELOG | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/clib.json b/clib.json index 27c495f..3fe7d63 100644 --- a/clib.json +++ b/clib.json @@ -1,6 +1,6 @@ { "name": "nuklear", - "version": "4.9.6", + "version": "4.10.1", "repo": "Immediate-Mode-UI/Nuklear", "description": "A small ANSI C gui toolkit", "keywords": ["gl", "ui", "toolkit"], diff --git a/src/CHANGELOG b/src/CHANGELOG index 44223af..bb0aad8 100644 --- a/src/CHANGELOG +++ b/src/CHANGELOG @@ -7,6 +7,7 @@ /// - [y]: Minor version with non-breaking API and library changes /// - [z]: Patch version with no direct changes to the API /// +/// - 2022/08/01 (4.10.1) - Fix cursor jumping back to beginning of text when typing more than nk_edit_xxx limit /// - 2022/05/27 (4.10.0) - Add nk_input_has_mouse_click_in_button_rect() to fix window move bug /// - 2022/04/18 (4.9.7) - Change button behavior when NK_BUTTON_TRIGGER_ON_RELEASE is defined to /// only trigger when the mouse position was inside the same button on down From df86105c695b4dbb5e3974b12a23377e170e031b Mon Sep 17 00:00:00 2001 From: opsJson Date: Mon, 1 Aug 2022 16:19:45 -0300 Subject: [PATCH 5/6] Fix tabs --- src/CHANGELOG | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/CHANGELOG b/src/CHANGELOG index bb0aad8..00ee208 100644 --- a/src/CHANGELOG +++ b/src/CHANGELOG @@ -7,7 +7,8 @@ /// - [y]: Minor version with non-breaking API and library changes /// - [z]: Patch version with no direct changes to the API /// -/// - 2022/08/01 (4.10.1) - Fix cursor jumping back to beginning of text when typing more than nk_edit_xxx limit +/// - 2022/08/01 (4.10.1) - Fix cursor jumping back to beginning of text when typing more than +/// nk_edit_xxx limit /// - 2022/05/27 (4.10.0) - Add nk_input_has_mouse_click_in_button_rect() to fix window move bug /// - 2022/04/18 (4.9.7) - Change button behavior when NK_BUTTON_TRIGGER_ON_RELEASE is defined to /// only trigger when the mouse position was inside the same button on down From e57ee582ab087af05ff61f767d977bb9aba3ca6c Mon Sep 17 00:00:00 2001 From: Rob Loach Date: Wed, 3 Aug 2022 13:00:54 -0400 Subject: [PATCH 6/6] Update NK_MIN() call to save a line of code --- nuklear.h | 5 +++-- src/nuklear_text_editor.c | 3 +-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/nuklear.h b/nuklear.h index 377fa6b..7af8bb1 100644 --- a/nuklear.h +++ b/nuklear.h @@ -26162,8 +26162,7 @@ nk_textedit_text(struct nk_text_edit *state, const char *text, int total_len) text+text_len, 1)) { nk_textedit_makeundo_insert(state, state->cursor, 1); - ++state->cursor; - state->cursor = NK_MIN(state->cursor, state->string.len); + state->cursor = NK_MIN(state->cursor + 1, state->string.len); state->has_preferred_x = 0; } } @@ -29657,6 +29656,8 @@ nk_tooltipfv(struct nk_context *ctx, const char *fmt, va_list args) /// - [y]: Minor version with non-breaking API and library changes /// - [z]: Patch version with no direct changes to the API /// +/// - 2022/08/01 (4.10.1) - Fix cursor jumping back to beginning of text when typing more than +/// nk_edit_xxx limit /// - 2022/05/27 (4.10.0) - Add nk_input_has_mouse_click_in_button_rect() to fix window move bug /// - 2022/04/18 (4.9.7) - Change button behavior when NK_BUTTON_TRIGGER_ON_RELEASE is defined to /// only trigger when the mouse position was inside the same button on down diff --git a/src/nuklear_text_editor.c b/src/nuklear_text_editor.c index bd93250..e381857 100644 --- a/src/nuklear_text_editor.c +++ b/src/nuklear_text_editor.c @@ -394,8 +394,7 @@ nk_textedit_text(struct nk_text_edit *state, const char *text, int total_len) text+text_len, 1)) { nk_textedit_makeundo_insert(state, state->cursor, 1); - ++state->cursor; - state->cursor = NK_MIN(state->cursor, state->string.len); + state->cursor = NK_MIN(state->cursor + 1, state->string.len); state->has_preferred_x = 0; } }