File tree Expand file tree Collapse file tree 2 files changed +28
-3
lines changed
Expand file tree Collapse file tree 2 files changed +28
-3
lines changed Original file line number Diff line number Diff line change 5757流程同generic-edit环境的版本,只是第三步改为
58583 . 插入一段Python块,输入内容(例如re)。
5959
60+ ## 2025/07/29 fix: custom-complete时删除掉前缀补全框不关闭
61+ ### What
62+ 修改了custom-complete对于prefix定义的条件,使用一个辅助变量prefix_initialized来判断是否定义,而不是使用prefix自身。
63+
64+ ### Why
65+ 补全项的第一项(补全中使用到的prefix)也可能是空字符串“”,这种情况发生时,如果使用` prefix != "" ` 来判断prefix是否初始化就不正确了。
66+
67+ ### 如何测试
68+ 这块bug fix比较小,不写在上面的流程中了。
69+ 0 . 确保 Completion style 设置为 Popup
70+ 1 . 插入一个Scheme块
71+ 2 . 插入一些可以补全的字符,例如"(a"
72+ 3 . 按tab补全
73+ 4 . 删除掉前缀,在这个例子里是"a"
74+ 5 . 检查:补全框因前缀为空而消失
75+
76+
6077## 2025/07/18 令Popup补全模式下不显示消息
6178### What
6279移除了Popup补全模式下显示消息的代码。
Original file line number Diff line number Diff line change @@ -338,18 +338,26 @@ edit_interface_rep::custom_complete (tree r) {
338338 int i, r_N= N (r);
339339 int min_compls_N= 1 ;
340340 string prefix;
341+ bool prefix_initialized= false ;
341342 hashset<string> compls;
342343 if (completion_style == string (" Popup" )) {
343344 min_compls_N= 2 ; // 至少需要2个补全结果(前缀自身和一个补全结果)
344345 compls << string (" " ); // 在补全结果中插入一个空值以保留前缀自身
345346 }
346- for (i= 0 ; i < r_N; i++)
347+ for (i= 0 ; i < r_N; i++) {
347348 if (is_atomic (r[i])) {
348349 string l= r[i]->label ;
349350 if (is_quoted (l)) l= scm_unquote (l);
350- if (prefix == " " ) prefix= l;
351- else compls << l;
351+ if (!prefix_initialized) {
352+ // 这里使用补全的第一个结果(自身)定义了 prefix
353+ // 第一个结果可能为空,所以不能使用 prefix = "" 来判断
354+ // 需要一个另外的辅助变量
355+ prefix = l;
356+ prefix_initialized= true ;
357+ }
358+ compls << l;
352359 }
360+ }
353361 // cout << prefix << ", " << compls << LF;
354362 if ((prefix == " " ) || (N (compls) < min_compls_N)) {
355363 set_input_normal ();
You can’t perform that action at this time.
0 commit comments