improve edit

This commit is contained in:
lixianjing 2019-07-01 09:08:19 +08:00
parent 93e6509246
commit d6472492eb
2 changed files with 9 additions and 1 deletions

View File

@ -35,6 +35,11 @@
#define STB_TEXTEDIT_NEWLINE (wchar_t)('\n') #define STB_TEXTEDIT_NEWLINE (wchar_t)('\n')
#define STB_TEXTEDIT_STRING text_edit_t #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" #include "stb/stb_textedit.h"
typedef struct _text_layout_info_t { typedef struct _text_layout_info_t {

View File

@ -424,7 +424,10 @@ static ret_t edit_on_key_down(widget_t* widget, key_event_t* e) {
} else { } else {
text_edit_key_down(edit->model, (key_event_t*)e); 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)) { } else if (system_info()->app_type != APP_DESKTOP && key < 128 && isprint(key)) {
edit_input_char(widget, (wchar_t)key); edit_input_char(widget, (wchar_t)key);
} }