From d6472492eb180fda9b6d65b5d45050c8bcb5b53f Mon Sep 17 00:00:00 2001 From: lixianjing Date: Mon, 1 Jul 2019 09:08:19 +0800 Subject: [PATCH] improve edit --- src/base/text_edit.c | 5 +++++ src/widgets/edit.c | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/base/text_edit.c b/src/base/text_edit.c index 0d687a224..8eecb174d 100644 --- a/src/base/text_edit.c +++ b/src/base/text_edit.c @@ -35,6 +35,11 @@ #define STB_TEXTEDIT_NEWLINE (wchar_t)('\n') #define STB_TEXTEDIT_STRING text_edit_t +#if !defined(WITH_SDL) +#define STB_TEXTEDIT_UNDOSTATECOUNT 10 +#define STB_TEXTEDIT_UNDOCHARCOUNT 32 +#endif /*WITH_SDL*/ + #include "stb/stb_textedit.h" typedef struct _text_layout_info_t { diff --git a/src/widgets/edit.c b/src/widgets/edit.c index dfba88d7f..79a0b8f40 100644 --- a/src/widgets/edit.c +++ b/src/widgets/edit.c @@ -424,7 +424,10 @@ static ret_t edit_on_key_down(widget_t* widget, key_event_t* e) { } else { text_edit_key_down(edit->model, (key_event_t*)e); } - edit_dispatch_event(widget, EVT_VALUE_CHANGING); + + if (key != TK_KEY_LEFT && key != TK_KEY_RIGHT && key != TK_KEY_HOME && key != TK_KEY_END) { + edit_dispatch_event(widget, EVT_VALUE_CHANGING); + } } else if (system_info()->app_type != APP_DESKTOP && key < 128 && isprint(key)) { edit_input_char(widget, (wchar_t)key); }