mirror of
https://codeberg.org/unspeaker/perch.git
synced 2025-12-06 09:36:42 +01:00
clamp scroll
This commit is contained in:
parent
57b418b567
commit
f4f38939d5
1 changed files with 2 additions and 1 deletions
|
|
@ -57,7 +57,8 @@ impl Handle<TuiIn> for Taggart {
|
||||||
if self.cursor > x_max {
|
if self.cursor > x_max {
|
||||||
self.offset += self.cursor - x_max;
|
self.offset += self.cursor - x_max;
|
||||||
}
|
}
|
||||||
if self.offset > self.display.h() {
|
if self.offset > self.entries.len().saturating_sub(self.display.h()) {
|
||||||
|
self.offset = self.entries.len().saturating_sub(self.display.h())
|
||||||
}
|
}
|
||||||
if self.cursor >= self.entries.len() {
|
if self.cursor >= self.entries.len() {
|
||||||
self.cursor = self.entries.len().saturating_sub(1)
|
self.cursor = self.entries.len().saturating_sub(1)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue