mirror of
https://github.com/mrusme/neonmodem.git
synced 2024-09-15 04:28:07 -04:00
Fixed view caching
This commit is contained in:
parent
8bd83d75c1
commit
cfd01d90d2
@ -130,7 +130,9 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
} else if m.focused == "post" {
|
||||
m.focused = "reply"
|
||||
|
||||
m.viewcache = m.View()
|
||||
m.ctx.Logger.Debugln("caching view")
|
||||
m.ctx.Logger.Debugf("buffer: %s", m.buffer)
|
||||
m.viewcache = m.buildView(false)
|
||||
|
||||
return m, m.textarea.Focus()
|
||||
}
|
||||
@ -216,9 +218,13 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
}
|
||||
|
||||
func (m Model) View() string {
|
||||
return m.buildView(true)
|
||||
}
|
||||
|
||||
func (m Model) buildView(cached bool) string {
|
||||
var view strings.Builder = strings.Builder{}
|
||||
|
||||
if m.focused == "reply" && m.viewcache != "" {
|
||||
if cached && m.focused == "reply" && m.viewcache != "" {
|
||||
m.ctx.Logger.Debugln("Cached View()")
|
||||
|
||||
m.textarea.SetWidth(m.viewcacheTextareaXY[2])
|
||||
|
Loading…
Reference in New Issue
Block a user