Skip to content

normal: make <c-o> always jump backward when snapshotting current selection#5446

Merged
mawww merged 1 commit intomawww:masterfrom
lobre:fix/c-o-always-jumps-back
Feb 19, 2026
Merged

normal: make <c-o> always jump backward when snapshotting current selection#5446
mawww merged 1 commit intomawww:masterfrom
lobre:fix/c-o-always-jumps-back

Conversation

@lobre
Copy link
Contributor

@lobre lobre commented Feb 16, 2026

JumpList::backward used to sometimes consume <c-o> without moving: when the current selection had diverged from the jump at m_current, we first pushed the current selection, then subtracted count.

With count=1, this landed on the freshly pushed entry itself, so <c-o> behaved like "save checkpoint" instead of "jump backward".

This was especially visible after going back into the middle of history, moving, then pressing <c-o> again: the first <c-o> could be a no-op from the user point of view.

Fix by treating the implicit push as an extra internal step: if we push current before jumping, move back by count + 1. This keeps the "preserve current position for <c-i>" behavior, while making <c-o> consistently perform an actual backward jump.

Add regression test: test/normal/jump/backward-dirty-middle

Fixes #5066

…ection

JumpList::backward used to sometimes consume <c-o> without moving:
when the current selection had diverged from the jump at m_current,
we first pushed the current selection, then subtracted count.

With count=1, this landed on the freshly pushed entry itself, so
<c-o> behaved like "save checkpoint" instead of "jump backward".

This was especially visible after going back into the middle of history,
moving, then pressing <c-o> again: the first <c-o> could be a no-op
from the user point of view.

Fix by treating the implicit push as an extra internal step:
if we push current before jumping, move back by count + 1.
This keeps the "preserve current position for <c-i>" behavior, while
making <c-o> consistently perform an actual backward jump.

Add regression test: test/normal/jump/backward-dirty-middle

Fixes mawww#5066
@mawww
Copy link
Owner

mawww commented Feb 19, 2026

Thanks, this looks like a nice cleanup of that function on top of fixing the bug.

@mawww mawww merged commit ea23355 into mawww:master Feb 19, 2026
4 of 6 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.

[BUG] <c-o> creates jump points instead of jumping backwards

2 participants