feat: CSV 导入导出、导入撤销支持及多项 bug 修复

功能:
- 新增 CSV 格式导入导出支持(含 BOM 处理、引号转义、智能标题行检测)
- 导入操作支持撤销/重做
- 保存时 PATH 长度检查与警告
- 深色模式状态持久化(darkmode.txt)
- 提取 get_current_target/push_record 为共享函数,消除控制器层重复代码
- 新增 string_list_insert_at,修复撤销删除时的索引恢复
- 新增 undo_redo、error_code、import_export 单元测试

Bug 修复:
- 修复备份目录对话框和失败原因的硬编码中文字符串
- 提取 get_exe_dir 到 os_env 消除 i18n.c/ui_utils.c 重复定义
- 修复导入撤销 old_sys/old_user 内存管理(push 后置 NULL 防止重复释放)
- 修复 CSV 导出转义与导入解析不一致(移除反斜杠转义,依赖 CSV 引号机制)
- 修正 PATH 长度 8191 限制描述为 "command line safe limit"
This commit is contained in:
2026-05-03 01:52:06 +08:00
parent 720ebb535d
commit cdcfd8e0a7
27 changed files with 1823 additions and 110 deletions
+8
View File
@@ -3,6 +3,7 @@
#include <iup.h>
#include "core/app_context.h"
#include "core/undo_redo.h"
#include "utils/i18n.h"
// 内部辅助函数声明(供各 callbacks_*.c 文件共享)
@@ -26,4 +27,11 @@ void refresh_undo_redo_buttons(Ihandle *dlg);
// 同步合并预览列表
void sync_merged_list(Ihandle *dlg);
// 获取当前 Tab 对应的 TargetType
TargetType get_current_target(Ihandle *dlg);
// 创建并推送撤销记录
void push_record(Ihandle *dlg, OperationType op_type, int index, int count,
char **old_paths, char **new_paths);
#endif // CALLBACKS_INTERNAL_H
+1
View File
@@ -20,5 +20,6 @@ void sync_string_list_to_ui(Ihandle *list_ui, const StringList *str_list);
// 深色模式状态管理
void set_dark_mode(int enabled);
int get_dark_mode(void);
void init_dark_mode(void);
#endif // UI_UTILS_H
+5
View File
@@ -2,6 +2,11 @@
#define OS_ENV_H
#include "utils/error_code.h"
#include <stddef.h>
// 获取可执行文件所在目录(带缓存)
// buf: 输出缓冲区,size: 缓冲区大小
void get_exe_dir(char *buf, size_t size);
// 检查是否以管理员权限运行
int check_admin(void);
+1
View File
@@ -14,6 +14,7 @@ typedef struct
// 字符串列表
void init_string_list(StringList *list);
void add_string_list(StringList *list, const char *str);
int string_list_insert_at(StringList *list, int index, const char *str);
void clear_string_list(StringList *list);
// 访问器函数 - 安全访问内部数据