Skip to content

Commit

Permalink
improve edit_ex
Browse files Browse the repository at this point in the history
  • Loading branch information
xianjimli committed Feb 28, 2025
1 parent 7bebd81 commit 49a1142
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

2025/02/28
* 完善 sync state to children(感谢兆坤提供补丁)
* 完善 edit_ex(感谢兆坤提供补丁)

2025/02/27
* 增加event_source_fd对象支持fd为-1和设置fd的情况(感谢智明提供补丁)
Expand Down
19 changes: 18 additions & 1 deletion src/ext_widgets/edit_ex/edit_ex_suggest_words_helper.inc
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,29 @@ static ret_t edit_ex_suggest_words_popup_on_close(void* ctx, event_t* e) {
return RET_OK;
}

static inline bool_t edit_ex_widget_set_prop_is_support(const char* name) {
const char* not_support_props[] = {
WIDGET_PROP_NAME,
};
uint32_t i = 0;
for (i = 0; i < ARRAY_SIZE(not_support_props); i++) {
if (tk_str_eq(name, not_support_props[i])) {
return FALSE;
}
}
return TRUE;
}

static ret_t edit_ex_widget_set_prop_by_object_on_visit(void* ctx, const void* data) {
widget_t* widget = WIDGET(ctx);
const named_value_t* nv = (const named_value_t*)(data);
return_value_if_fail(widget != NULL && nv != NULL, RET_BAD_PARAMS);

widget_set_prop(widget, nv->name, &nv->value);
if (edit_ex_widget_set_prop_is_support(nv->name)) {
widget_set_prop(widget, nv->name, &nv->value);
} else {
log_error("%s : Not support set prop \"%s\"!\n", __FUNCTION__, nv->name);
}

return RET_OK;
}
Expand Down

0 comments on commit 49a1142

Please sign in to comment.