improve input engine fix issue #290

This commit is contained in:
lixianjing 2019-12-03 15:48:44 +08:00
parent 45e18cd02f
commit a844bbbe7b
3 changed files with 6 additions and 5 deletions

View File

@ -6,6 +6,7 @@
* idle\_manager\_exist 判断条件有误(感谢朝泽提供补丁)。
* 完善 widget\_create\_animator感谢培煌提供补丁
* 在窗口打开时递归update style。
* 完善输入避免google pinyin崩溃
* 2019/12/02
* 完整 list item 支持 return/space 激活 (感谢 [jianmin zhuang](https://github.com/zjm1060) 提供补丁)。

View File

@ -40,10 +40,6 @@ ret_t input_engine_input(input_engine_t* engine, int key) {
ret_t ret = RET_OK;
return_value_if_fail(engine != NULL, RET_BAD_PARAMS);
if (engine->keys.size >= TK_IM_MAX_INPUT_CHARS) {
return RET_BAD_PARAMS;
}
if (key == TK_KEY_BACKSPACE || key == TK_KEY_DELETE) {
if (engine->keys.size > 0) {
engine->keys.size--;
@ -52,6 +48,10 @@ ret_t input_engine_input(input_engine_t* engine, int key) {
return RET_FAIL;
}
} else {
if (engine->keys.size >= TK_IM_MAX_INPUT_CHARS) {
return RET_BAD_PARAMS;
}
str_append_char(&(engine->keys), (char)key);
}

View File

@ -32,7 +32,7 @@ typedef struct _input_engine_t input_engine_t;
typedef ret_t (*input_engine_reset_input_t)(input_engine_t* engine);
typedef ret_t (*input_engine_input_t)(input_engine_t* engine, int key);
#define TK_IM_MAX_INPUT_CHARS 15
#define TK_IM_MAX_INPUT_CHARS 11
#define TK_IM_MAX_CANDIDATE_CHARS 127
/**