Skip to content

Fix vertical caret movement - #185

Merged
cyanzhong merged 1 commit into
mainfrom
develop
Sep 5, 2026
Merged

cyanzhong merged 1 commit into
mainfrom
develop

Conversation

@cyanzhong

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The new vertical-motion logic uses range.assoc || 1, which incorrectly overrides a valid assoc = 0 and can produce incorrect coordinate/selection behavior.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR introduces a custom “ArrowUp / Shift-ArrowUp” vertical movement command for the hidden-syntax editor mode to correct cases where CodeMirror vertical motion skips over an ATX heading line, and adds targeted tests to lock in the expected behavior.

Changes:

  • Added cursorLineUp / selectLineUp commands plus a correctedLineUp keymap extension to adjust upward motion when an ATX heading is skipped.
  • Registered the new keymap in the hidden-syntax base extension so it applies when hiddenSyntaxExtension is enabled.
  • Added a new “Vertical motion” test suite covering correction behavior, selection-extension semantics, multi-selection fallback behavior, and precedence with higher-priority keymaps.
File summaries
File Description
tests/hiddenSyntax.test.ts Adds a “Vertical motion” test suite validating corrected ArrowUp/Shift-ArrowUp behavior and precedence rules.
src/hiddenSyntax/selection.ts Implements corrected upward vertical motion commands and exports a Prec.high keymap extension.
src/hiddenSyntax/index.ts Wires the new corrected ArrowUp keymap into the hidden-syntax base extension.
Review details
  • Files reviewed: 3/5 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/hiddenSyntax/selection.ts
@cyanzhong
cyanzhong merged commit 6e056ab into main Sep 5, 2026
2 checks passed
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.

2 participants