Skip to content

[6008] tmfs 缓冲区无需保存,关闭软件时不提示保存 - #4671

Open
da-liii wants to merge 1 commit into
mainfrom
da/6008/tmfs_no_save
Open

da-liii wants to merge 1 commit into
mainfrom
da/6008/tmfs_no_save

Conversation

@da-liii

@da-liii da-liii commented Sep 24, 2026

Copy link
Copy Markdown
Contributor

任务简述

彻底消除关闭软件或关闭窗口时对 tmfs 虚拟缓冲区的保存提示:

  1. C++ 层面:
    • 在 new_view.hpp / new_view.cpp 中新增 is_no_save_buffer(url) 谓词;
    • 在 tm_buffer_rep::needs_to_be_saved()、needs_to_be_autosaved() 以及 edit_modify_rep::need_save() 中对 tmfs 缓冲区恒返回 false,阻止编辑器置脏;
    • 在 buffer_modified(url) 和 buffer_modified_since_autosave(url) 中对 tmfs 缓冲区直接返回 false;
  2. Scheme 层面:
    • 在 tm-server.scm 中定义 (buffer-no-save? buf),涵盖所有 (url-rooted-tmfs? buf) 与 (buffer-aux? buf);
    • 在 safely-quit-TeXmacs 中使用 (filter (non buffer-no-save?) m) 过滤待保存列表,确保内部虚拟缓冲区不进入退出流程;
    • 在 safely-kill-window、safely-kill-tabpage、safely-kill-tabpage-by-url、safely-kill-buffer 中加入 buffer-no-save? 检查并直接关闭;
    • 在 confirm-close-dialog 中移除 (url-rooted-tmfs? buffer) 作为草稿的逻辑,并在入口处若遇到 buffer-no-save? 直接调用 (on-dont-save);
  3. 测试覆盖:
    • 新增 C++ 单元测试 tests/Data/tmfs_no_save_test.cpp(xmake b tmfs_no_save_test && xmake r tmfs_no_save_test);
    • 新增 Scheme 集成测试 TeXmacs/tests/6008.scm(xmake r 6008)。

return false;
// tmfs 虚拟协议缓冲区属于内部虚拟视图或辅助缓冲区,无需保存。
// 阻止底层编辑器置脏,消除关闭/退出时的保存提示。
if (!is_nil (buf) && is_no_save_buffer (buf->buf->name)) return false;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里之前加了 collab 的特判,这里删除是有问题的

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant