feature: make backward content visible when moving cursor back in input field

This commit is contained in:
Shupeng Xue 2024-06-24 17:20:56 +10:00
parent f1cf136df4
commit 574ee27993
No known key found for this signature in database
GPG key ID: A6C508165D76B601

View file

@ -39,8 +39,8 @@ impl Input {
));
let (limit, snap) = (self.limit(), self.snap_mut());
if snap.offset > snap.cursor {
snap.offset = snap.cursor;
if snap.offset + limit / 2 > snap.cursor {
snap.offset = snap.cursor.saturating_sub(limit / 2);
} else if snap.value.is_empty() {
snap.offset = 0;
} else {