Skip to content

Commit

Permalink
Clear VirtualText inside SetPage
Browse files Browse the repository at this point in the history
  • Loading branch information
maaslalani committed Nov 1, 2021
1 parent cce6980 commit 8e3bd52
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions internal/model/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
m.search.Begin()
return m, nil
case "ctrl+n":
m.VirtualText = ""
// Go to next occurrence
m.search.Execute(&m)
case "ctrl+e":
Expand All @@ -163,10 +162,8 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
Page: m.Page,
TotalSlides: len(m.Slides),
}, keyPress)
if newState.Page != m.Page {
m.VirtualText = ""
}
m.buffer, m.Page = newState.Buffer, newState.Page
m.buffer = newState.Buffer
m.SetPage(newState.Page)
}

case fileWatchMsg:
Expand Down Expand Up @@ -278,6 +275,11 @@ func (m *Model) CurrentPage() int {
}

func (m *Model) SetPage(page int) {
if m.Page == page {
return
}

m.VirtualText = ""
m.Page = page
}

Expand Down

0 comments on commit 8e3bd52

Please sign in to comment.