Skip to content

fix: 修复搜索模式下窗口关闭按钮失效的问题#1751

Closed
makoMakoGo wants to merge 1 commit intochen08209:mainfrom
makoMakoGo:fix/search-close-button-issue-1574
Lines changed: 4 additions & 4 deletions
Closed

fix: 修复搜索模式下窗口关闭按钮失效的问题#1751
makoMakoGo wants to merge 1 commit intochen08209:mainfrom
makoMakoGo:fix/search-close-button-issue-1574

Conversation

@makoMakoGo
Copy link

关联 Issue

Fixes #1574

问题描述

在连接面板、代理面板、请求面板进行搜索后,如果不关闭搜索框,窗口的关闭按钮会失效。

原因分析

当进入搜索模式时,SystemBackBlock 会设置 backBlock = true,目的是防止用户通过系统返回键意外退出搜索/编辑模式。

handleBackOrExit() 函数会检查这个标志,导致所有关闭操作都被阻止,包括用户显式点击的关闭按钮。

修复方案

handleBackOrExit() 添加 force 参数:

  • force = false(默认):保持原有行为,系统返回键/快捷键会先退出搜索模式
  • force = true:跳过 backBlock 检查,允许直接关闭窗口

窗口关闭按钮和系统窗口关闭事件使用 force: true,确保用户的显式关闭意图能被执行。

改动文件

  • lib/controller.dart:添加 force 参数
  • lib/manager/window_manager.dart:关闭按钮和 onWindowClose 事件使用 force: true

测试

已在 Windows 11 上测试通过:

  • ✅ 搜索模式下点击关闭按钮可正常关闭
  • ✅ 搜索模式下系统标题栏 X 按钮可正常关闭
  • ✅ 快捷键 Ctrl+W 仍保持原有行为(先退出搜索)

Fixes #1574

When the search box is active, SystemBackBlock sets backBlock=true to
prevent accidental exit via system back button. However, this also
blocked the explicit window close button.

Added a `force` parameter to handleBackOrExit(). When force=true
(used by window close button and system close events), the backBlock
check is bypassed, allowing the window to close properly.
@makoMakoGo
Copy link
Author

已编译验证后在Windows上验证过,验证截图由另一外用户上传

@makoMakoGo
Copy link
Author

@chen08209 看一下,困扰我朋友很久的bug

@makoMakoGo makoMakoGo closed this by deleting the head repository Feb 19, 2026
@vivodi
Copy link

vivodi commented Mar 14, 2026

@makoMakoGo 这个问题依旧存在,为什么要关闭这个PR?

@makoMakoGo
Copy link
Author

makoMakoGo commented Mar 14, 2026

@makoMakoGo 这个问题依旧存在,为什么要关闭这个PR?

你看下contributors列表,这作者从不审 pr 也不合并 pr,趁早换项目用吧

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.

[BUG] 连接面板上任意搜索后导致无法关闭窗口

2 participants