fix: resolve layout glitch when resizing the window

Ensures markdown content is rendered correctly after window resize.
Previously, resizing could break layout due to improper initialization.
This commit is contained in:
Luis Gustavo S. Barreto 2025-06-27 11:01:50 -03:00
commit 3cbfb8bd3e
2 changed files with 3 additions and 1 deletions

View file

@ -12,6 +12,7 @@ import (
"github.com/charmbracelet/bubbles/spinner"
"github.com/charmbracelet/bubbles/textinput"
tea "github.com/charmbracelet/bubbletea"
"github.com/charmbracelet/glow/v2/utils"
"github.com/charmbracelet/lipgloss"
"github.com/charmbracelet/log"
"github.com/muesli/reflow/ansi"
@ -860,7 +861,7 @@ func loadLocalMarkdown(md *markdown) tea.Cmd {
log.Debug("error reading local file", "error", err)
return errMsg{err}
}
md.Body = string(data)
md.Body = string(utils.RemoveFrontmatter(data))
return fetchedMarkdownMsg(md)
}
}

View file

@ -175,6 +175,7 @@ func newModel(cfg Config, content string) tea.Model {
m.state = stateShowDocument
m.pager.currentDocument = markdown{
localPath: path,
Body: content,
Note: stripAbsolutePath(path, cwd),
Modtime: info.ModTime(),
}