Don't move up/down by more rows than the requested ones
Co-Authored-By: Max Brunsfeld <max@zed.dev>
This commit is contained in:
parent
f7cba4cec4
commit
2893c9bdb7
1 changed files with 10 additions and 20 deletions
|
@ -69,16 +69,11 @@ pub fn up_by_rows(
|
||||||
goal_column = 0;
|
goal_column = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
let clip_bias = if point.column() == map.line_len(point.row()) {
|
let mut clipped_point = map.clip_point(point, Bias::Left);
|
||||||
Bias::Left
|
if clipped_point.row() < point.row() {
|
||||||
} else {
|
clipped_point = map.clip_point(point, Bias::Right);
|
||||||
Bias::Right
|
}
|
||||||
};
|
(clipped_point, SelectionGoal::Column(goal_column))
|
||||||
|
|
||||||
(
|
|
||||||
map.clip_point(point, clip_bias),
|
|
||||||
SelectionGoal::Column(goal_column),
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn down_by_rows(
|
pub fn down_by_rows(
|
||||||
|
@ -105,16 +100,11 @@ pub fn down_by_rows(
|
||||||
goal_column = map.column_to_chars(point.row(), point.column())
|
goal_column = map.column_to_chars(point.row(), point.column())
|
||||||
}
|
}
|
||||||
|
|
||||||
let clip_bias = if point.column() == map.line_len(point.row()) {
|
let mut clipped_point = map.clip_point(point, Bias::Right);
|
||||||
Bias::Left
|
if clipped_point.row() > point.row() {
|
||||||
} else {
|
clipped_point = map.clip_point(point, Bias::Left);
|
||||||
Bias::Right
|
}
|
||||||
};
|
(clipped_point, SelectionGoal::Column(goal_column))
|
||||||
|
|
||||||
(
|
|
||||||
map.clip_point(point, clip_bias),
|
|
||||||
SelectionGoal::Column(goal_column),
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn line_beginning(
|
pub fn line_beginning(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue