File tree Expand file tree Collapse file tree 1 file changed +42
-8
lines changed
Expand file tree Collapse file tree 1 file changed +42
-8
lines changed Original file line number Diff line number Diff line change 1919
2020(define isreplace? #f)
2121
22-
22+ #|
23+ update-search-pos-text
24+ 更新搜索/替换窗口的位置显示文本。
25+
26+ 语法
27+ ----
28+ (update-search-pos-text action)
29+
30+ 参数
31+ ----
32+ action : string
33+ 表示搜索动作类型的字符串:
34+ - " new" : 新搜索
35+ - " next" : 下一个匹配项
36+ - " previous" : 上一个匹配项
37+ - " first" : 第一个匹配项
38+ - " last" : 最后一个匹配项
39+
40+ 返回值
41+ ----
42+ #<unspecified>
43+ 无显式返回值(返回 #<unspecified>)。
44+
45+ 逻辑
46+ ----
47+ 1. 如果 isreplace? 为 #t(刚刚执行了替换操作),使用 " new" 作为 action
48+ 否则使用传入的 action 参数
49+ 2. 调用 get-alt-selection-index 获取当前选择项的索引字符串(如 " 1/5" )
50+ 3. 重置 isreplace? 标志为 #f,确保只影响当前这次调用
51+ 4. 根据索引字符串设置辅助窗口标题:
52+ - 如果索引字符串为空,只显示搜索/替换文本
53+ - 否则显示 " 搜索文本 (索引字符串)" 格式
54+
55+ 注意
56+ ----
57+ 此函数用于在搜索/替换操作后更新辅助窗口的标题显示,提供用户友好的位置反馈。
58+ |#
2359(tm-define (update-search-pos-text action)
24- (let* ((index-str (if isreplace?
25- (begin
26- (let ((idx (get-alt-selection-index " alternate" " new" )))
27- (set! isreplace? #f )
28- idx))
29- (get-alt-selection-index " alternate" action))))
60+ (let* ((effective-action (if isreplace? " new" action))
61+ (index-str (get-alt-selection-index " alternate" effective-action)))
62+ (when isreplace?
63+ (set! isreplace? #f ))
3064 (if (== index-str " " )
3165 (set-auxiliary-widget-title (translate search-replace-text))
3266 (set-auxiliary-widget-title
33- (string-append (translate search-replace-text) " (" index-str " )" )))))
67+ (string-append (translate search-replace-text) " (" index-str " )" )))))
3468
3569
3670
You can’t perform that action at this time.
0 commit comments