mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
Merge the match arms
This commit is contained in:
parent
8e9eed408c
commit
a652aab632
1 changed files with 2 additions and 7 deletions
|
|
@ -60,13 +60,8 @@ enum OptStep {
|
||||||
impl OptStep {
|
impl OptStep {
|
||||||
fn cursor(self, snap: &InputSnap) -> usize {
|
fn cursor(self, snap: &InputSnap) -> usize {
|
||||||
match self {
|
match self {
|
||||||
Self::Offset(n) => {
|
Self::Offset(n) if n <= 0 => snap.cursor.saturating_add_signed(n),
|
||||||
if n <= 0 {
|
Self::Offset(n) => snap.count().min(snap.cursor + n as usize),
|
||||||
snap.cursor.saturating_add_signed(n)
|
|
||||||
} else {
|
|
||||||
snap.count().min(snap.cursor + n as usize)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Self::Bol => 0,
|
Self::Bol => 0,
|
||||||
Self::Eol => snap.count(),
|
Self::Eol => snap.count(),
|
||||||
Self::FirstChar => {
|
Self::FirstChar => {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue