mirror of
https://github.com/charmbracelet/glow.git
synced 2026-08-21 07:34:18 +02:00
Add Arabic pagination if the dot nav gets wider than the terminal width
This commit is contained in:
parent
3619ad137a
commit
85c121d0ac
1 changed files with 8 additions and 0 deletions
|
|
@ -17,6 +17,7 @@ import (
|
|||
"github.com/charmbracelet/charm/ui/common"
|
||||
"github.com/dustin/go-humanize"
|
||||
runewidth "github.com/mattn/go-runewidth"
|
||||
"github.com/muesli/reflow/ansi"
|
||||
"github.com/muesli/reflow/wordwrap"
|
||||
te "github.com/muesli/termenv"
|
||||
)
|
||||
|
|
@ -492,6 +493,13 @@ func stashView(m stashModel) string {
|
|||
if m.paginator.TotalPages > 1 {
|
||||
pagination = paginator.View(m.paginator)
|
||||
|
||||
// If the dot pagination is wider than the width of the window
|
||||
// switch to the arabic paginator.
|
||||
if ansi.PrintableRuneWidth(pagination) > m.terminalWidth-stashViewHorizontalPadding {
|
||||
m.paginator.Type = paginator.Arabic
|
||||
pagination = common.Subtle(paginator.View(m.paginator))
|
||||
}
|
||||
|
||||
if !m.stashFullyLoaded {
|
||||
pagination += common.Subtle(" ···")
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue