Skip to content

Fix yank around paragraph missing newline#43583

Merged
dinocosta merged 4 commits intozed-industries:mainfrom
van-sprundel:fix-yank-around-paragraph-missing-newline
Dec 3, 2025
Merged

Fix yank around paragraph missing newline#43583
dinocosta merged 4 commits intozed-industries:mainfrom
van-sprundel:fix-yank-around-paragraph-missing-newline

Conversation

@van-sprundel
Copy link
Contributor

@van-sprundel van-sprundel commented Nov 26, 2025

Use MotionKind::LineWise in both
vim::normal::change::Vim.change_object and
vim::normal::yank::Vim.yank_object when dealing with objects that
target Mode::VisualLine, for example, paragraphs. This fixes an issue
where yanking and changing paragraphs would not include the trailing
newline character.

Closes #28804

Release Notes:

  • Fixed linewise text object operations (yap, cap, etc.) omitting trailing blank line in vim mode

Other linewise objects like EntireFile and Method (when around=true)
also work correctly. Non-linewise objects will still use
MotionKind::Exclusive
@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Nov 26, 2025
@van-sprundel van-sprundel marked this pull request as draft November 26, 2025 19:52
@dinocosta
Copy link
Member

Thank you @van-sprundel ! The approach seems sensible to me 🙂

I've pushed a single commit ed980ed to leverage the existing use crate::state::Mode in both crates/vim/src/normal/change.rs and crates/vim/src/normal/yank.rs .

@dinocosta dinocosta merged commit 575ea49 into zed-industries:main Dec 3, 2025
24 checks passed
@franciskafyi franciskafyi moved this from Community PRs to Done in Quality Week – December 2025 Dec 11, 2025
CherryWorm pushed a commit to CherryWorm/zed that referenced this pull request Dec 16, 2025
Use `MotionKind::LineWise` in both
`vim::normal::change::Vim.change_object` and
`vim::normal::yank::Vim.yank_object` when dealing with objects that
target `Mode::VisualLine`, for example, paragraphs. This fixes an issue
where yanking and changing paragraphs would not include the trailing
newline character.

Closes zed-industries#28804

Release Notes:

- Fixed linewise text object operations (`yap`, `cap`, etc.) omitting
trailing blank line in vim mode

---------

Co-authored-by: dino <dinojoaocosta@gmail.com>
someone13574 pushed a commit to someone13574/zed that referenced this pull request Dec 16, 2025
Use `MotionKind::LineWise` in both
`vim::normal::change::Vim.change_object` and
`vim::normal::yank::Vim.yank_object` when dealing with objects that
target `Mode::VisualLine`, for example, paragraphs. This fixes an issue
where yanking and changing paragraphs would not include the trailing
newline character.

Closes zed-industries#28804

Release Notes:

- Fixed linewise text object operations (`yap`, `cap`, etc.) omitting
trailing blank line in vim mode

---------

Co-authored-by: dino <dinojoaocosta@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement

Projects

Development

Successfully merging this pull request may close these issues.

Yank around paragraph: empty line missing

2 participants