Fix vim surround behavior around text objects (#17603)

Performing `ysa")` on `"Hello World"` should produce `("Hello World")`.
Instead it places the parens inside the quotes (i.e. `"(Hello World)"`).
This PR fixes the behavior by preserving the `around` flag from the
operator sequence.

Closes #12976 and partially fixes #13841

Release Notes:

- Fixed the behavior of surrounding a text object in vim.
This commit is contained in:
Eric Andres 2024-09-10 09:49:04 -06:00 committed by GitHub
parent d5498c52f8
commit 5f61e3140f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 38 additions and 4 deletions

View file

@ -248,7 +248,7 @@ impl Vim {
}
Some(Operator::AddSurrounds { target: None }) => {
waiting_operator = Some(Operator::AddSurrounds {
target: Some(SurroundsType::Object(object)),
target: Some(SurroundsType::Object(object, around)),
});
}
Some(Operator::ToggleComments) => self.toggle_comments_object(object, around, cx),