Skip to content

feat(editor): warn on empty command targets - #323

Merged
fcoury merged 1 commit into
fcoury/bracket-motion-warningsfrom
fcoury/navigation-boundary-warnings
Aug 23, 2026
Merged

fcoury merged 1 commit into
fcoury/bracket-motion-warningsfrom
fcoury/navigation-boundary-warnings

Conversation

@fcoury-oai

Copy link
Copy Markdown
Collaborator

Commands that Red accepts but cannot complete still mix silent no-ops with ordinary informational messages. That makes it hard to distinguish a missing target from an ignored command. Building on #322, this follow-up applies the same transient, quiet warning contract to other discrete navigation and context-sensitive actions.

This change warns at match, character-search, syntax-swap, jumplist, undo/redo, and directional-window boundaries, including operator forms that must leave the buffer unchanged. Search misses and successful top/bottom wrapping now provide warning feedback without changing wrapscan behavior. LSP definition and diagnostic actions, document symbols, references, Git hunk actions, and inline-comment commands also warn when their final result has no eligible target.

Depends on #322.

How to Test

  1. In a buffer without a matching delimiter or requested character, run % and an operator motion such as dfx. Expect a transient warning, no cursor movement for %, and no edit for the operator motion.
  2. At the start or end of the jumplist or undo history, or with no window in a requested Ctrl-w direction, repeat the command. Expect the existing boundary text with warning styling.
  3. Run a search with no prior pattern or no matches. Expect a warning. With wrapscan enabled, repeat a search across the top or bottom and expect the cursor to move while the wrap boundary is reported.
  4. Invoke go-to-definition, line diagnostics, document symbols, references, a Git hunk action, or an inline-comment action where no target exists. Expect a warning only after the final result is known.
  5. Run the focused regressions:
    • cargo test --test movement --no-default-features
    • cargo test --test editing boundaries_report_no_op --no-default-features
    • cargo test --lib warn --no-default-features
    • cargo test --lib git_hunk_navigation_targets_changed_lines_and_reports_boundaries --no-default-features

The full Rust lint validation passes with cargo clippy --all-targets --all-features -- -D warnings.

@fcoury
fcoury merged commit f240839 into fcoury/bracket-motion-warnings Aug 23, 2026
1 check passed
@fcoury
fcoury deleted the fcoury/navigation-boundary-warnings branch August 23, 2026 03:14
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