fix nk_do_edit: Keep scroll position when re-activating edit widget.
How to test: Construct two edit widgets. Enter a long text into the first edit widget, so that the widget autoscrolls. Click into second (still empty) edit widget. Click into first edit widget again. => Text jums back, so that first character of text in first edit widget is visible again. This patch keeps the scroll position of the edit widget constant.
This commit is contained in:
parent
363c2ac632
commit
9236b92f86
|
@ -26535,7 +26535,10 @@ nk_do_edit(nk_flags *state, struct nk_command_buffer *out,
|
|||
if (!prev_state && edit->active) {
|
||||
const enum nk_text_edit_type type = (flags & NK_EDIT_MULTILINE) ?
|
||||
NK_TEXT_EDIT_MULTI_LINE: NK_TEXT_EDIT_SINGLE_LINE;
|
||||
/* keep scroll position when re-activating edit widget */
|
||||
struct nk_vec2 oldscrollbar = edit->scrollbar;
|
||||
nk_textedit_clear_state(edit, type, filter);
|
||||
edit->scrollbar = oldscrollbar;
|
||||
if (flags & NK_EDIT_AUTO_SELECT)
|
||||
select_all = nk_true;
|
||||
if (flags & NK_EDIT_GOTO_END_ON_ACTIVATE) {
|
||||
|
@ -29094,6 +29097,7 @@ nk_tooltipfv(struct nk_context *ctx, const char *fmt, va_list args)
|
|||
/// - [yy]: Minor version with non-breaking API and library changes
|
||||
/// - [zz]: Bug fix version with no direct changes to API
|
||||
///
|
||||
/// - 2020/05/27 (4.02.5) - Fix nk_do_edit: Keep scroll position when re-activating edit widget.
|
||||
/// - 2020/05/09 (4.02.4) - Fix nk_menubar height calculation bug
|
||||
/// - 2020/05/08 (4.02.3) - Fix missing stdarg.h with NK_INCLUDE_STANDARD_VARARGS
|
||||
/// - 2020/04/30 (4.02.2) - Fix nk_edit border drawing bug
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "nuklear",
|
||||
"version": "4.02.4",
|
||||
"version": "4.02.5",
|
||||
"repo": "Immediate-Mode-UI/Nuklear",
|
||||
"description": "A small ANSI C gui toolkit",
|
||||
"keywords": ["gl", "ui", "toolkit"],
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
/// - [yy]: Minor version with non-breaking API and library changes
|
||||
/// - [zz]: Bug fix version with no direct changes to API
|
||||
///
|
||||
/// - 2020/05/27 (4.02.5) - Fix nk_do_edit: Keep scroll position when re-activating edit widget.
|
||||
/// - 2020/05/09 (4.02.4) - Fix nk_menubar height calculation bug
|
||||
/// - 2020/05/08 (4.02.3) - Fix missing stdarg.h with NK_INCLUDE_STANDARD_VARARGS
|
||||
/// - 2020/04/30 (4.02.2) - Fix nk_edit border drawing bug
|
||||
|
|
|
@ -195,7 +195,10 @@ nk_do_edit(nk_flags *state, struct nk_command_buffer *out,
|
|||
if (!prev_state && edit->active) {
|
||||
const enum nk_text_edit_type type = (flags & NK_EDIT_MULTILINE) ?
|
||||
NK_TEXT_EDIT_MULTI_LINE: NK_TEXT_EDIT_SINGLE_LINE;
|
||||
/* keep scroll position when re-activating edit widget */
|
||||
struct nk_vec2 oldscrollbar = edit->scrollbar;
|
||||
nk_textedit_clear_state(edit, type, filter);
|
||||
edit->scrollbar = oldscrollbar;
|
||||
if (flags & NK_EDIT_AUTO_SELECT)
|
||||
select_all = nk_true;
|
||||
if (flags & NK_EDIT_GOTO_END_ON_ACTIVATE) {
|
||||
|
|
Loading…
Reference in New Issue