diff --git a/pkg/ui/components/code/code.go b/pkg/ui/components/code/code.go index 50e56f4aff0112ac095c5788227b3c9112bfe9f0..416cd85d0a0066396f506f595592e74524b6c76b 100644 --- a/pkg/ui/components/code/code.go +++ b/pkg/ui/components/code/code.go @@ -77,7 +77,11 @@ func (r *Code) SetSideNote(s string) tea.Cmd { // Init implements tea.Model. func (r *Code) Init() tea.Cmd { - w := r.common.Width + // XXX: We probably won't need the GetHorizontalFrameSize margin + // subtraction if we get the new viewport soft wrapping to play nicely with + // Glamour. This also introduces a bug where when it soft wraps, the + // viewport scrolls left/right for 2 columns on each side of the screen. + w := r.common.Width - r.common.Styles.App.GetHorizontalFrameSize() content := r.content if content == "" { r.Viewport.Model.SetContent(r.NoContentStyle.String())