Fix shift-y on empty line in vim mode (#29253)

Release Notes:

- Fixes a regression where `shift-v up` on an empty line would appear to
have selected the line after (though in reality it did not)
This commit is contained in:
Conrad Irwin 2025-04-23 09:06:55 -06:00 committed by GitHub
parent 266c41ed9a
commit a320d324f1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -808,10 +808,14 @@ impl DisplaySnapshot {
// used by line_mode selections and tries to match vim behavior
pub fn expand_to_line(&self, range: Range<Point>) -> Range<Point> {
let new_start = MultiBufferPoint::new(range.start.row, 0);
let new_end = MultiBufferPoint::new(
range.end.row,
self.buffer_snapshot.line_len(MultiBufferRow(range.end.row)),
);
let new_end = if range.end.column > 0 {
MultiBufferPoint::new(
range.end.row,
self.buffer_snapshot.line_len(MultiBufferRow(range.end.row)),
)
} else {
range.end
};
new_start..new_end
}