mirror of
https://github.com/charmbracelet/glow
synced 2024-12-13 13:42:34 +00:00
Update pagintion after changing sections when resetting the filter
Fixes #251
This commit is contained in:
parent
851d21f6c4
commit
3a572216ad
1 changed files with 8 additions and 1 deletions
|
@ -313,14 +313,21 @@ func (m *stashModel) resetFiltering() {
|
|||
m.bakeConvertedDocs()
|
||||
|
||||
sort.Stable(markdownsByLocalFirst(m.markdowns))
|
||||
m.updatePagination()
|
||||
|
||||
// If the filtered section is present (it's always at the end) slice it out
|
||||
// of the sections slice to remove it from the UI.
|
||||
if m.sections[len(m.sections)-1].key == filterSection {
|
||||
m.sections = m.sections[:len(m.sections)-1]
|
||||
}
|
||||
|
||||
// If the current section is out of bounds (it would be if we cut down the
|
||||
// slice above) then return to the first section.
|
||||
if m.sectionIndex > len(m.sections)-1 {
|
||||
m.sectionIndex = 0
|
||||
}
|
||||
|
||||
// Update pagination after we've switched sections.
|
||||
m.updatePagination()
|
||||
}
|
||||
|
||||
// Is a filter currently being applied?
|
||||
|
|
Loading…
Reference in a new issue