From abd9175b0d88f82d6234c1041f7c974b120b46e4 Mon Sep 17 00:00:00 2001 From: lixianjing Date: Fri, 12 Jan 2024 16:37:03 +0800 Subject: [PATCH] improve candidates --- docs/changes.md | 1 + src/ext_widgets/keyboard/candidates.c | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/docs/changes.md b/docs/changes.md index 59257678e9..612325350a 100644 --- a/docs/changes.md +++ b/docs/changes.md @@ -3,6 +3,7 @@ 2024/01/12 * 实现 conf\_doc\_foreach 函数(感谢林福提供补丁) * 实现 data\_reader\_can\_read 函数(感谢林福提供补丁) + * 修复5keys输入中文后如果没有候选词时焦点会消失的问题(感谢颖健提供补丁) 2024/01/11 * 增加一个编译参数类型用于None的情况下识别编译传参类型以及修复app和awtk编译模式不同的问题(感谢智明提供补丁) diff --git a/src/ext_widgets/keyboard/candidates.c b/src/ext_widgets/keyboard/candidates.c index 8966941630..1c6b11b176 100644 --- a/src/ext_widgets/keyboard/candidates.c +++ b/src/ext_widgets/keyboard/candidates.c @@ -49,6 +49,7 @@ static ret_t candidates_on_button_focused(void* ctx, event_t* e) { static ret_t candidates_on_button_click(void* ctx, event_t* e) { char str[32]; + widget_t* focus = NULL; widget_t* widget = WIDGET(ctx); widget_t* button = WIDGET(e->target); widget_t* keyboard = widget_get_window(widget); @@ -69,8 +70,14 @@ static ret_t candidates_on_button_click(void* ctx, event_t* e) { if (suggest_words->words_nr > 0) { widget_set_focused(widget_get_child(button->parent, 0), TRUE); candidates->is_suggest = TRUE; + } else { + focus = widget_get_focused_widget(keyboard); + widget_focus_down(focus); } log_debug("suggest_words->words:%s\n", suggest_words->words); + } else { + focus = widget_get_focused_widget(keyboard); + widget_focus_down(focus); } } /* After commit text, if candidates is hidden we need to blur it and reset key_target! */