A simple CPU rendered GUI IDE experience.
Diffstat (limited to 'src/text.rs')
| -rw-r--r-- | src/text.rs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/text.rs b/src/text.rs index 2f4d30a..2fa0c26 100644 --- a/src/text.rs +++ b/src/text.rs @@ -728,15 +728,16 @@ impl TextArea { } } } - #[lower::apply(saturating)] - pub fn scroll_to_cursor_centering(&mut self) { - let (_, y) = self.primary_cursor(); - + pub fn scroll_to_ln_centering(&mut self, y: usize) { if !(self.vo..self.vo + self.r).contains(&y) { self.vo = y - (self.r / 2); } } + pub fn scroll_to_cursor_centering(&mut self) { + let (_, y) = self.primary_cursor(); + self.scroll_to_ln_centering(y); + } #[cold] pub fn tree_sit<'c>(&self, path: Option<&Path>, cell: &mut Output) { let language = path |