mirror of
https://github.com/LHY0125/PathEditor.git
synced 2026-05-10 02:09:46 +08:00
fix(undo): 修复撤销按钮状态不刷新及空指针防护
- 将 refresh_undo_redo_buttons 提升为公共函数(声明在 callbacks_internal.h,实现在 callbacks.c) - 在所有 push_record 的操作回调末尾调用 refresh_undo_redo_buttons,确保按钮状态实时更新 - 修复 redo() 中 OP_CLEAN/OP_IMPORT 的 new_paths 空指针风险 - 移除 undo_redo.c 中废弃的 apply_record 函数 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -76,6 +76,8 @@ int btn_new_cb(Ihandle *self)
|
||||
|
||||
int count = IupGetInt(current_list, "COUNT");
|
||||
IupSetInt(current_list, "VALUE", count);
|
||||
|
||||
refresh_undo_redo_buttons(dlg);
|
||||
}
|
||||
}
|
||||
return IUP_DEFAULT;
|
||||
@@ -114,6 +116,8 @@ int btn_edit_cb(Ihandle *self)
|
||||
|
||||
sync_string_list_to_ui(current_list, raw_data);
|
||||
IupSetInt(current_list, "VALUE", selected);
|
||||
|
||||
refresh_undo_redo_buttons(dlg);
|
||||
}
|
||||
}
|
||||
return IUP_DEFAULT;
|
||||
@@ -168,6 +172,8 @@ int btn_browse_cb(Ihandle *self)
|
||||
|
||||
int count = IupGetInt(current_list, "COUNT");
|
||||
IupSetInt(current_list, "VALUE", count);
|
||||
|
||||
refresh_undo_redo_buttons(dlg);
|
||||
}
|
||||
}
|
||||
IupDestroy(filedlg);
|
||||
@@ -208,5 +214,6 @@ int btn_del_cb(Ihandle *self)
|
||||
if (lbl_status)
|
||||
IupSetAttribute(lbl_status, "TITLE", lua_config_get_string("status", "deleted"));
|
||||
|
||||
refresh_undo_redo_buttons(dlg);
|
||||
return IUP_DEFAULT;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user