diff --git a/internal/ui/dialog/sessions.go b/internal/ui/dialog/sessions.go index 8f3ce81960e5170c0059d44261c1e79ca2bbfea8..3b0a033218a1dafa547b8c6b016b0123b48b97f5 100644 --- a/internal/ui/dialog/sessions.go +++ b/internal/ui/dialog/sessions.go @@ -237,7 +237,10 @@ func (s *Session) Draw(scr uv.Screen, area uv.Rectangle) *tea.Cursor { t.Dialog.HelpView.GetVerticalFrameSize() + t.Dialog.View.GetVerticalFrameSize() s.input.SetWidth(max(0, innerWidth-t.Dialog.InputPrompt.GetHorizontalFrameSize()-1)) // (1) cursor padding - s.list.SetSize(innerWidth, height-heightOffset) + listHeight := height - heightOffset + listTotalHeight := s.list.TotalHeight() + listWidth := max(0, innerWidth-3) // Reserve space for scrollbar. + s.list.SetSize(listWidth, listHeight) s.help.SetWidth(innerWidth) // This makes it so we do not scroll the list if we don't have to @@ -309,6 +312,10 @@ func (s *Session) Draw(scr uv.Screen, area uv.Rectangle) *tea.Cursor { rc.AddPart(inputView) } listView := t.Dialog.List.Height(s.list.Height()).Render(s.list.Render()) + scrollbar := common.Scrollbar(t, listHeight, listTotalHeight, listHeight, s.list.Offset()) + if scrollbar != "" { + listView = lipgloss.JoinHorizontal(lipgloss.Top, listView, scrollbar) + } rc.AddPart(listView) rc.Help = s.help.View(s)