fix: update visibility function regexp (#496)

* fix: update visibility function regexp

* fix(quick-window): tolerate optional var decl in visibility regex

Make the `var <name>(,<name>)*;` prefix optional so the regex
matches both the older shape (`function L7A(){return!Ct...}`,
1.3109.0) and the current one (`function aZA(){var e;return!Qt...}`,
1.3883.0). The minifier hoists `var e;` whenever the function body
uses optional chaining; if a future release adds `var e,t;` or
drops the var entirely, this still matches without another
chase-the-shape PR.

Verified end-to-end on the live 1.3883.0 build asar: extracts
`pF` / `aZA`, patches both Quick Entry anchor sites
("Navigating to existing chat", "Creating new chat with
submit_quick_entry"), JS validates, idempotent re-run confirmed.
Confirmed against the 1.3109.0 build-reference shape too.

Repro of #390 on Nobara KDE Plasma 6 (Wayland): quick-entry
submit now reliably shows the main window post-patch; no
regressions in regular chat or window restore flows.

Co-Authored-By: Claude <claude@anthropic.com>

* docs(readme): credit @Andrej730 for visibility regex fix (#495)

Co-Authored-By: Claude <claude@anthropic.com>

---------

Co-authored-by: aaddrick <aaddrick@gmail.com>
Co-authored-by: Claude <claude@anthropic.com>
This commit is contained in:
Andrej730
2026-04-27 18:20:46 +05:00
committed by GitHub
parent cf2b0fc357
commit d4db72865b
2 changed files with 10 additions and 3 deletions

View File

@@ -245,7 +245,9 @@ Special thanks to:
- **[davidamacey](https://github.com/davidamacey)** for identifying and fixing the XRDP GPU compositing blank-window issue on remote desktop sessions
- **[pb3ck](https://github.com/pb3ck)** for diagnosing the Cowork `CLAUDE_CODE_OAUTH_TOKEN` env-strip bug with a working reference diff
- **[aJV99](https://github.com/aJV99)** for exporting `GDK_BACKEND=wayland` in native Wayland mode to fix XWayland fallback blur on HiDPI displays
- **[Andrej730](https://github.com/Andrej730)** for the quick-window regex readability refactor (`String.raw` + `escapeRegExp` helper)
- **[Andrej730](https://github.com/Andrej730)**
- Quick-window regex readability refactor (`String.raw` + `escapeRegExp` helper)
- Fixing the visibility-function regex break on Claude Desktop 1.3883.0 (#495)
## Sponsorship

View File

@@ -66,10 +66,15 @@ if (!focusedMatch) {
const focusFn = focusedMatch[1];
console.log(' Found focus check function: ' + focusFn);
// Find the sibling isVisible function defined near the focus function
// Find the sibling isVisible function defined near the focus function.
// Tolerate the optional `var <name>(,<name>)*;` declaration the
// minifier hoists when the function body uses optional chaining
// (1.3883.0+ shape: `function aZA(){var e;return!Qt...}`). Older
// builds don't declare anything before `return!`. The non-capturing
// group keeps the prefix optional in either case.
const focusFnIdx = code.indexOf('function ' + focusFn + '(');
const nearbyCode = code.substring(focusFnIdx, focusFnIdx + 500);
const visFnRe = /function (\w+)\(\)\{return!\w+\|\|\w+\.isDestroyed\(\)\?!1:\w+\.isVisible\(\)/;
const visFnRe = /function (\w+)\(\)\{(?:var \w+(?:,\w+)*;)?return!\w+\|\|\w+\.isDestroyed\(\)\?!1:\w+\.isVisible\(\)/;
const visMatch = nearbyCode.match(visFnRe);
if (!visMatch) {
console.log(' WARNING: Could not find visibility function near ' +