1use std::{
2 cell::{Cell, RefCell},
3 rc::Rc,
4};
5
6use gpui::{Bounds, Point, point, size};
7use terminal::Terminal;
8use ui::{Pixels, ScrollableHandle, px};
9
10#[derive(Debug)]
11struct ScrollHandleState {
12 line_height: Pixels,
…lines 13–42 unchanged (30 lines)
43 pub fn update(&self, terminal: &Terminal) {
44 *self.state.borrow_mut() = ScrollHandleState::new(terminal);
45 }
46}
47
48impl ScrollableHandle for TerminalScrollHandle {
49 fn max_offset(&self) -> Point<Pixels> {
50 let state = self.state.borrow();
51 point(
52 Pixels::ZERO,
53 state.total_lines.saturating_sub(state.viewport_lines) as f32 * state.line_height,
54 )
55 }
56
57 fn offset(&self) -> Point<Pixels> {
…lines 58–88 unchanged (31 lines)