Skip to content

feat: add yy to copy mode#82

Closed
BrettKulp wants to merge 7 commits intoleohenon:ocvfrom
BrettKulp:feat/copymode_yy
Closed

feat: add yy to copy mode#82
BrettKulp wants to merge 7 commits intoleohenon:ocvfrom
BrettKulp:feat/copymode_yy

Conversation

@BrettKulp
Copy link
Copy Markdown

add yy to copymode to copy current line in normal mode

Copy link
Copy Markdown
Owner

@leohenon leohenon left a comment

Choose a reason for hiding this comment

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

copy mode pending y survives other handled keys.

Example: y j y triggers yy.

Since yy is the only supported y operator here, you can clear pending y when the next key is not y.

@leohenon
Copy link
Copy Markdown
Owner

leohenon commented Apr 29, 2026

The 150ms flash delay is fine, but maybe copy mode should probably exit immediately after yy so the timeout doesn't keep copy mode active during the flash.

Also I think normal prompt yank flash uses 70ms, maybe we should also use 70ms here for consistency?

@BrettKulp BrettKulp changed the title add yy to copymode to copy current line in normal mode feat: add yy to copymode to copy current line in normal mode Apr 29, 2026
@leohenon leohenon changed the title feat: add yy to copymode to copy current line in normal mode feat: add yy to copy mode Apr 29, 2026
@leohenon
Copy link
Copy Markdown
Owner

This fixes y j y, but pending y is still cleared too late. Keys like H/M/L and v/V return before the clear, so pending y can still survive.

We should clear pending y near the top of copy mode handling before other handlers run.

@leohenon
Copy link
Copy Markdown
Owner

leohenon commented Apr 29, 2026

we should probably also add a test for this, e.g. y H y should not trigger yy.

@BrettKulp
Copy link
Copy Markdown
Author

My bad. Will fix and add test

@BrettKulp
Copy link
Copy Markdown
Author

This should be better now. I noticed that line 1049 and 1067 both have the same issue f H k will finish the jump to the next k on the line after the cursor moves. Would it be better to clear pending before the return always unless the key needs to stay in pending state?

@leohenon
Copy link
Copy Markdown
Owner

leohenon commented May 1, 2026

Thanks. Yes theres also an ordering issue for f/F/t/T and z but that should be fixed separately.

The y fix/test look good. Just a few things:

  • git diff --check fails on trailing whitespace in the new test
  • resolve the merge conflict
  • please revert the immediate copy mode exit after yy as it makes the flash render in the wrong place. That
    was my bad, preserving the correct flash is more important.

Other than that, this should be good.

@leohenon leohenon force-pushed the feat/copymode_yy branch from 1fe716b to 3195a00 Compare May 2, 2026 04:24
@leohenon
Copy link
Copy Markdown
Owner

leohenon commented May 2, 2026

Thanks, just cleaned up a couple more things I noticed:

yy was linewise, but should be charwise so pasting into the prompt doesn’t add an extra line.

The exit delay was still 150ms but should match the 70ms yank flash.

Also simplified the highlight code and stopped exposing the flash state.

Implemented on ocv in 9049c0b

@leohenon leohenon closed this May 2, 2026
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