From 207be3c771d281baae6e5fa0fb74be9a056e97a2 Mon Sep 17 00:00:00 2001 From: Can Celik Date: Tue, 1 Sep 2026 15:48:22 +0300 Subject: refactor: render the shell in the client (#3487) * feat: add opt-in client-rendered shell * feat: add client-owned shell mouse controls * feat: complete client-owned shell chrome * feat: add client-owned shell settings and notifications * feat: run client shell custom commands * feat: render popup terminals in client shell * feat: add client-owned scrollback and copy mode * fix: preserve client worktree trust defaults * feat: render startup diagnostics in client shell * feat: render onboarding in client shell * feat: render product announcements in client shell * feat: render release notes in client shell * feat: render mobile switcher in client shell * feat: render kitty graphics in client shell * fix: preserve client shell lifecycle coherence * refactor: route client shell commands through endpoint connections * refactor: make the client-rendered shell the default * refactor: remove monolithic launch mode * refactor: complete client-rendered shell cutover * perf: retain client pane surface updates * perf: scale retained pane surface updates * perf: remove remote pane input latency * test: make client shell checks platform-independent * fix: prevent client timer starvation * test: fix client shell platform gates * test: accept retained surfaces in cross-area checks * test: make client mode assertions platform-neutral * fix: badge only outdated integrations --- src/ui/scrollbar.rs | 50 ++++++++++++++++++++++++++++++++------------------ 1 file changed, 32 insertions(+), 18 deletions(-) (limited to 'src/ui/scrollbar.rs') diff --git a/src/ui/scrollbar.rs b/src/ui/scrollbar.rs index b73b2c50..cf700825 100644 --- a/src/ui/scrollbar.rs +++ b/src/ui/scrollbar.rs @@ -1,4 +1,5 @@ use ratatui::{ + buffer::Buffer, layout::Rect, style::{Color, Style}, Frame, @@ -75,7 +76,7 @@ pub(crate) fn scrollbar_thumb_grab_offset( row: u16, ) -> Option { let thumb = scrollbar_thumb(metrics, track)?; - (row >= thumb.top && row < thumb.top + thumb.len).then_some(row - thumb.top) + (row >= thumb.top && row < thumb.top + thumb.len).then(|| row - thumb.top) } fn scrollbar_offset_from_thumb_top( @@ -132,8 +133,8 @@ pub(crate) fn scrollbar_offset_from_drag_row( scrollbar_offset_from_thumb_top(metrics, track, desired_top) } -pub(super) fn render_scrollbar( - frame: &mut Frame, +pub(crate) fn render_scrollbar_buffer( + buffer: &mut Buffer, metrics: crate::pane::ScrollMetrics, track: Rect, track_color: Color, @@ -148,19 +149,40 @@ pub(super) fn render_scrollbar( return; }; - let buf = frame.buffer_mut(); for y in track.y..track.y + track.height { - let cell = &mut buf[(track.x, y)]; + let cell = &mut buffer[(track.x, y)]; cell.set_symbol("▕"); cell.set_style(Style::default().fg(track_color)); } for y in thumb.top..thumb.top + thumb.len { - let cell = &mut buf[(track.x, y)]; + let cell = &mut buffer[(track.x, y)]; cell.set_symbol(thumb_symbol); cell.set_style(Style::default().fg(thumb_color)); } } +pub(crate) fn render_pane_scrollbar_buffer( + buffer: &mut Buffer, + metrics: crate::pane::ScrollMetrics, + track: Rect, + palette: &crate::app::state::Palette, + focused: bool, +) { + let (track_color, thumb_color, thumb_symbol) = if focused { + (palette.overlay0, palette.overlay1, "▐") + } else { + (palette.surface_dim, palette.overlay0, "▕") + }; + render_scrollbar_buffer( + buffer, + metrics, + track, + track_color, + thumb_color, + thumb_symbol, + ); +} + pub(super) fn render_pane_scrollbar( app: &AppState, frame: &mut Frame, @@ -173,19 +195,11 @@ pub(super) fn render_pane_scrollbar( let Some(track) = pane_scrollbar_rect(info) else { return; }; - - let (track_color, thumb_color, thumb_symbol) = if info.is_focused { - (app.palette.overlay0, app.palette.overlay1, "▐") - } else { - (app.palette.surface_dim, app.palette.overlay0, "▕") - }; - - render_scrollbar( - frame, + render_pane_scrollbar_buffer( + frame.buffer_mut(), metrics, track, - track_color, - thumb_color, - thumb_symbol, + &app.palette, + info.is_focused, ); } -- cgit v1.2.3