vim: implement <space> in normal mode (#7011)
This fixes #6815 by implementing `<space>` in normal mode in Vim. Turns out that `<space>` behaves like a reverse `<backspace>` (which we already had): it goes to the right and, if at end of line, to the next line. That means I had to touch `movement::right`, which is used in a few places, but it's documentation said that it would go to the next line, which it did *not*. So I changed the behaviour. But I would love another pair of eyes on this, because I don't want to break non-Vim behaviour. Release Notes: - Added support for `<space>` in Vim normal mode: `<space>` goes to the right and to next line if at end of line. ([#6815](https://github.com/zed-industries/zed/issues/6815)).
This commit is contained in:
parent
4af542567c
commit
7b8bd97652
3 changed files with 29 additions and 4 deletions
|
@ -50,11 +50,10 @@ pub fn saturating_left(map: &DisplaySnapshot, mut point: DisplayPoint) -> Displa
|
|||
map.clip_point(point, Bias::Left)
|
||||
}
|
||||
|
||||
/// Returns a column to the right of the current point, wrapping
|
||||
/// to the next line if that point is at the end of line.
|
||||
/// Returns a column to the right of the current point, doing nothing
|
||||
// if that point is at the end of the line.
|
||||
pub fn right(map: &DisplaySnapshot, mut point: DisplayPoint) -> DisplayPoint {
|
||||
let max_column = map.line_len(point.row());
|
||||
if point.column() < max_column {
|
||||
if point.column() < map.line_len(point.row()) {
|
||||
*point.column_mut() += 1;
|
||||
} else if point.row() < map.max_point().row() {
|
||||
*point.row_mut() += 1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue