Skip to content

check typeof cm.hasFocus before calling to avoid uncaught TypeError#8

Open
Nagidrop wants to merge 3 commits into
liuxingyu521:masterfrom
Nagidrop:master
Open

check typeof cm.hasFocus before calling to avoid uncaught TypeError#8
Nagidrop wants to merge 3 commits into
liuxingyu521:masterfrom
Nagidrop:master

Conversation

@Nagidrop

@Nagidrop Nagidrop commented May 11, 2026

Copy link
Copy Markdown

Fixes the error by checking typeof cm.hasFocus before invoking it, falling back to reading it as a boolean when it is not a function.

Also fixes security vulnerabilities by the way.

Third commit is vibe-coded, aims to improve performance, feel free to exclude it.

Closes #7

@Nagidrop Nagidrop changed the title check typeof cm.hasFocus before calling to avoid uncaught TypeError check typeof cm.hasFocus before calling to avoid uncaught TypeError May 11, 2026
- Add `cancelAnimationFrame` to safely kill the `requestAnimationFrame`
  loop during cleanup, preventing background spam when rapidly switching files.
- Revert static `activeEditor` caching to evaluate dynamically inside the
  keydown event, fixing interaction bugs with split panes and workspaces.
- Consolidate event and frame clearing into a single `cleanup()` method.
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.

TypeError: cm.hasFocus is not a function on pressing Arrow Down

1 participant