Skip to content

fix: let no-op cursor moves fall through - #1208

Open
okuuva wants to merge 1 commit into
nushell:mainfrom
okuuva:push-lvopwtlqrxup
Open

fix: let no-op cursor moves fall through#1208
okuuva wants to merge 1 commit into
nushell:mainfrom
okuuva:push-lvopwtlqrxup

Conversation

@okuuva

@okuuva okuuva commented Sep 8, 2026

Copy link
Copy Markdown

Summary

Make cursor movement commands report whether they changed the cursor or selection, allowing UntilFound to continue to a fallback event after a blocked move.
Enables e.g. navigating multiline prompts while still allowing atuin to trigger search for command line history when hitting Up on the topmost line.

This changes observable UntilFound behavior but does not change Reedline's public API.

Before

Cursor movement commands always reported Applied, even when they left the cursor and selection unchanged.
A blocked movement therefore stopped UntilFound before its fallback event could run.

After

Cursor movement commands compare the complete cursor state before and after execution.
They report Inapplicable when neither the position nor selection changes, allowing UntilFound to try its next event.
Movements that change the cursor or collapse a selection still report Applied.
Tests cover vertical, horizontal, and line-edge movements, plus a missing-target selection motion.

Additional notes

Addresses the cursor-movement portion of #876.

Related Atuin issue: atuinsh/atuin#798

Comment thread src/core_editor/editor.rs

self.update_undo_state(new_undo_behavior);
status
if matches!(command.edit_type(), EditType::MoveCursor { .. })

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This regresses menu handling.

ReedlineEvent::Edit returns early on Inapplicable at engine.rs:1709, before the quick-completion bookkeeping below it, and MoveToLineStart { select: false } is in that block's deactivate list.
So with quick_completions on and a menu open, Ctrl+A with the cursor already at the line start no longer closes the menu, where on main it does.

Either exempt the deactivate-list commands from the early return, or run the bookkeeping before it.

Cursor movement commands always reported Applied, even when they left
the cursor and selection unchanged. That stopped UntilFound before a
fallback event could run.

Compare the complete cursor state before and after every MoveCursor
command. Report Inapplicable only when neither position nor selection
changes, so blocked moves fall through while selection collapse remains
Applied.

Cover vertical, horizontal, and line-edge movements at boundaries, plus
a missing-target selection motion.

Addresses the cursor-movement portion of nushell#876.
See also: atuinsh/atuin#798
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