File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 12161216(tm-define (kbd-cut) (clipboard-cut " primary" ))
12171217(tm-define (kbd-paste)
12181218 (clipboard-paste " primary" )
1219- (when (chat-input-buffer? ( current-buffer-url))
1219+ (when (and (defined? ' chat-input-buffer?) (chat-input-buffer? ( current-buffer-url) ))
12201220 (qt-chat-notify-input-height)
12211221 ) ; when
12221222 (when (defined? 'tutorial-notify-action )
14671467 ) ; lambda
14681468 ) ; with-magic-paste-check
14691469 ) ; if
1470- (when (chat-input-buffer? ( current-buffer-url))
1470+ (when (and (defined? ' chat-input-buffer?) (chat-input-buffer? ( current-buffer-url) ))
14711471 (qt-chat-notify-input-height)
14721472 ) ; when
14731473 (when (defined? 'tutorial-notify-action )
Original file line number Diff line number Diff line change 225225 (do-paste fm)
226226 (with-magic-paste-check (lambda () (do-paste fm)))
227227 ) ; if
228- (when (chat-input-buffer? ( current-buffer-url))
228+ (when (and (defined? ' chat-input-buffer?) (chat-input-buffer? ( current-buffer-url) ))
229229 (qt-chat-notify-input-height)
230230 ) ; when
231231 ) ; when
Original file line number Diff line number Diff line change 162162) ; tm-define
163163
164164(tm-define (table-resize-notify t)
165- (when (chat-input-buffer? (current-buffer-url))
165+ ; ; chat-input-buffer? 由 llm 插件懒加载定义;插件未加载时(如 headless 测试
166+ ; ; 或未启用 chat 的发行)符号 unbound,用 defined? 兜底,避免抛错。
167+ (when (and (defined? 'chat-input-buffer? ) (chat-input-buffer? (current-buffer-url)))
166168 (qt-chat-notify-input-height)
167169 ) ; when
168170) ; tm-define
Original file line number Diff line number Diff line change 1+ ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2+ ; ;
3+ ; ; MODULE : 1150.scm
4+ ; ; DESCRIPTION : 基准测试:在表格中连续插入新行的性能
5+ ; ; COPYRIGHT : (C) 2026 Mogan STEM
6+ ; ;
7+ ; ; PURPOSE
8+ ; ; 测量"在表格里连续向下插入 N 行"的总耗时与单行平均耗时,
9+ ; ; 作为后续表格插入路径优化的对比基线。
10+ ; ;
11+ ; ; 实现要点:
12+ ; ; - `(make 'tabular)` 新建 1×1 表格并定位光标到首个 cell,
13+ ; ; 与「插入 → 表格」菜单同源。
14+ ; ; - `(table-insert-row #t)` 是 kbd-enter / 菜单"Row below"走的路径。
15+ ; ; - 每行插入之间不插入 kbd 等待或排版抖动;insert 内部已驱动必要的
16+ ; ; 排版增量更新,测量的是真实用户体感的"按一下回车"链路耗时。
17+ ; ;
18+ ; ; USAGE
19+ ; ; xmake b stem
20+ ; ; xmake r 1150
21+ ; ;
22+ ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
23+
24+ (texmacs-module (texmacs tests 1150 ))
25+
26+ (define insert-count 1000)
27+
28+ (define (bench-insert-rows n )
29+ (make 'tabular )
30+ (let ((start (texmacs-time)))
31+ (let loop ((i 0 ))
32+ (when (< i n)
33+ (table-insert-row #t )
34+ (loop (+ i 1 ))
35+ ) ; when
36+ ) ; let
37+ (let* ((elapsed (- (texmacs-time) start))
38+ (per-row (if (zero? n) 0 (/ elapsed n)))
39+ ) ;
40+ (display " [1150] insert " )
41+ (display n)
42+ (display " rows: total=" )
43+ (display elapsed)
44+ (display " ms, per-row=" )
45+ (display per-row)
46+ (display " ms" )
47+ (newline)
48+ ) ; let*
49+ ) ; let
50+ ) ; define
51+
52+ (tm-define (test_1150)
53+ (bench-insert-rows insert-count)
54+ ) ; tm-define
Original file line number Diff line number Diff line change 1+ # 1150 表格插入行性能基准
2+
3+ ## 背景
4+
5+ 排查"表格里连续插入新行"的响应耗时。需要一个稳定的可重跑基准,
6+ 便于后续优化前后对比。
7+
8+ ## What
9+
10+ 新增 ` TeXmacs/tests/1150.scm ` ,在 headless 编辑器里:
11+
12+ 1 . ` (make 'tabular) ` 新建一个 1×1 表格
13+ 2 . 连续调用 ` (table-insert-row #t) ` 插入 N 行(默认 N=1000)
14+ 3 . 用 ` texmacs-time ` 计时,输出总耗时与每行平均耗时
15+
16+ 实现风格参考 ` TeXmacs/tests/1144.scm ` (纯 headless 基准,无 GUI、
17+ 无 ` exec-delayed-at ` 异步链)。
18+
19+ ## How to run
20+
21+ ``` bash
22+ xmake b stem
23+ xmake r 1150
24+ ```
25+
26+ ## 涉及文件
27+
28+ - ` TeXmacs/tests/1150.scm ` (新增)
You can’t perform that action at this time.
0 commit comments