Skip to content

feat(editor): warn at bracket navigation boundaries - #322

Merged
fcoury merged 2 commits into
mainfrom
fcoury/bracket-motion-warnings
Aug 23, 2026
Merged

fcoury merged 2 commits into
mainfrom
fcoury/bracket-motion-warnings

Conversation

@fcoury-oai

Copy link
Copy Markdown
Collaborator

Bracket navigation currently fails inconsistently at document boundaries: some motions silently do nothing, some report generic informational text, and diagnostic navigation wraps to the other end of the buffer. This makes it difficult to tell whether Red accepted the command or found no eligible target.

This change gives the default ] and [ navigation families consistent, target-specific warning feedback while leaving the cursor unchanged. Diagnostic navigation no longer wraps. Structural operator motions preserve the buffer when their target is missing, and the plugin host gains PrintWarning so Git hunk navigation can use the same transient warning presentation without creating an acknowledgment obligation.

How to Test

  1. Open a Rust file with a final function, class, or function call. From the last eligible target, press ]f, ]c, or ]m. Expect a target-specific warning and no cursor movement.
  2. Run d]f where no later function exists. Expect the same warning and no buffer edit.
  3. From the final diagnostic, press ]d. Expect No more valid diagnostics to move to; the cursor must not wrap to the first diagnostic.
  4. In a buffer without a Git hunk or inline item target, press ]h or ]i. Expect transient warning-styled feedback.
  5. Run the focused regressions:
    • cargo test --test movement closing_bracket --no-default-features
    • cargo test --lib diagnostic_navigation_orders_utf16_positions_without_wrapping --no-default-features
    • cargo test --lib git_hunk_navigation_targets_changed_lines_and_reports_boundaries --no-default-features
    • cargo test --lib overlapping_inline_navigation_warns_when_nothing_is_under_the_cursor --no-default-features
    • cargo test --lib print_warning_is_transient_and_does_not_require_acknowledgment --no-default-features

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

@fcoury
fcoury merged commit b65a427 into main Aug 23, 2026
12 checks passed
@fcoury
fcoury deleted the fcoury/bracket-motion-warnings branch August 23, 2026 03:20
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