mirror of
https://codeberg.org/unspeaker/perch.git
synced 2025-12-07 01:56:45 +01:00
factor out modules; modal -> dialog
This commit is contained in:
parent
c075871e50
commit
b157a87647
7 changed files with 163 additions and 158 deletions
20
src/keys.rs
20
src/keys.rs
|
|
@ -55,23 +55,3 @@ impl Handle<TuiIn> for Taggart {
|
|||
Ok(None)
|
||||
}
|
||||
}
|
||||
|
||||
impl Taggart {
|
||||
fn clamp (&mut self, min: usize, max: usize) {
|
||||
if self.cursor < min {
|
||||
self.offset = self.cursor;
|
||||
}
|
||||
if self.cursor > max {
|
||||
self.offset += self.cursor - max;
|
||||
}
|
||||
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() {
|
||||
self.cursor = self.entries.len().saturating_sub(1)
|
||||
}
|
||||
if self.column + 1 > self.columns.0.len() {
|
||||
self.column = self.columns.0.len().saturating_sub(1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue