vim: Fix some problems with visual mode testing (#8461)

Release Notes:

- N/A
This commit is contained in:
Conrad Irwin 2024-02-26 20:15:27 -07:00 committed by GitHub
parent 079c31fcac
commit 8cf36ae603
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 43 additions and 25 deletions

View file

@ -131,17 +131,22 @@ impl Object {
pub fn target_visual_mode(self, current_mode: Mode) -> Mode {
match self {
Object::Word { .. } if current_mode == Mode::VisualLine => Mode::Visual,
Object::Word { .. } => current_mode,
Object::Sentence
Object::Word { .. }
| Object::Sentence
| Object::Quotes
| Object::BackQuotes
| Object::DoubleQuotes
| Object::VerticalBars
| Object::Parentheses
| Object::DoubleQuotes => {
if current_mode == Mode::VisualBlock {
Mode::VisualBlock
} else {
Mode::Visual
}
}
Object::Parentheses
| Object::SquareBrackets
| Object::CurlyBrackets
| Object::AngleBrackets
| Object::VerticalBars
| Object::Argument => Mode::Visual,
}
}