diff --git a/ui/views/posts/posts.go b/ui/views/posts/posts.go index e54207a..2236151 100644 --- a/ui/views/posts/posts.go +++ b/ui/views/posts/posts.go @@ -118,9 +118,9 @@ func NewModel(c *ctx.Ctx) Model { m.list.SetShowTitle(false) m.list.SetShowStatusBar(false) - m.textarea = textarea.New() - m.textarea.Placeholder = "Type in your reply ..." - m.textarea.Prompt = "" + // m.textarea = textarea.New() + // m.textarea.Placeholder = "Type in your reply ..." + // m.textarea.Prompt = "" m.a, _ = aggregator.New(m.ctx) @@ -148,6 +148,7 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { if ok { // m.ctx.Loading = true // cmds = append(cmds, m.loadItem(&i)) + m.viewcache = m.buildView(false) cmd := cmd.New(cmd.WinOpen, postshow.WIN_ID, cmd.Arg{ Name: "post", Value: &i, diff --git a/ui/views/posts/view.go b/ui/views/posts/view.go index e3128f7..c271a40 100644 --- a/ui/views/posts/view.go +++ b/ui/views/posts/view.go @@ -13,18 +13,12 @@ func (m Model) View() string { func (m Model) buildView(cached bool) string { var view strings.Builder = strings.Builder{} - // if cached && m.WMisFocused("reply") && m.viewcache != "" { - // m.ctx.Logger.Debugln("Cached View()") - // - // m.textarea.SetWidth(m.viewcacheTextareaXY[2]) - // m.textarea.SetHeight(m.viewcacheTextareaXY[3]) - // - // return helpers.PlaceOverlay( - // m.viewcacheTextareaXY[0], m.viewcacheTextareaXY[1], - // m.textarea.View(), m.viewcache, - // false) - // } - // + if cached && m.focused == false && m.viewcache != "" { + m.ctx.Logger.Debugln("Cached View()") + + return m.viewcache + } + m.ctx.Logger.Debugln("Posts.View()") var l string = "" if m.focused {