mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-21 23:01:05 +00:00
fix: panic caused by incorrect offset reset
This commit is contained in:
parent
0ea9bcda5f
commit
027c7a79c1
2 changed files with 7 additions and 5 deletions
|
|
@ -39,7 +39,7 @@ impl Input {
|
|||
);
|
||||
|
||||
let snap = self.snap_mut();
|
||||
if snap.cursor < snap.offset {
|
||||
if snap.offset > snap.cursor {
|
||||
snap.offset = snap.cursor;
|
||||
} else if snap.value.is_empty() {
|
||||
snap.offset = 0;
|
||||
|
|
|
|||
|
|
@ -55,11 +55,13 @@ impl Input {
|
|||
std::ops::Bound::Excluded(_) => unreachable!(),
|
||||
std::ops::Bound::Unbounded => 0,
|
||||
};
|
||||
if snap.value.drain(range).next().is_some() {
|
||||
self.flush_value();
|
||||
return true;
|
||||
if snap.value.drain(range).next().is_none() {
|
||||
return false;
|
||||
}
|
||||
false
|
||||
|
||||
self.move_(0);
|
||||
self.flush_value();
|
||||
true
|
||||
}
|
||||
|
||||
fn backspace(&mut self, under: bool) -> bool {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue