Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions devel/204_30.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@
3. 触发一次保存
4. 使用 vscode 或其他纯文本编辑器,打开刚刚保存的 tmu 文档,查看 tmu 头部的 style 块,不应该携带 dark 字样

测试项五:导出PDF只允许浅色
1. 进入软件的深色主题
2. 在深色主题下,打开任意 tmu 文件,文档背景色应该是深色
3. 点击 文件->导出->PDF,或者 文件->预览,我们最终看到的PDF都应该是将软件调整为浅色主题打开tmu文件看到的渲染效果

## 2026/03/31 文档主题跟随软件主题,保存时不保留dark

### What
Expand Down
13 changes: 13 additions & 0 deletions src/Edit/Editor/edit_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,16 @@ edit_main_rep::print_doc (url name, bool conform, int first, int last) {
if (conform && (medium != "paper")) conform= false;
// FIXME: better command for conform printing

// Save current style and remove dark theme for printing
tree saved_style= the_style;
if (the_style == "dark") the_style= tree (TUPLE);
else if (is_func (the_style, TUPLE)) {
tree style (TUPLE);
for (int i= 0; i < N (the_style); ++i)
if (the_style[i] != "dark") style << the_style[i];
the_style= style;
}

typeset_preamble ();
// FIXME: when printing several files via aux buffers,
// it seems that the style can be corrupted. Why?
Expand Down Expand Up @@ -281,6 +291,9 @@ edit_main_rep::print_doc (url name, bool conform, int first, int last) {
}
tm_delete (ren);
delete_typesetter (ttt);

// Restore original style
the_style= saved_style;
}

void
Expand Down
Loading