mirror of
https://github.com/walles/moar.git
synced 2024-11-30 02:34:13 +03:00
Scroll left / right to show / hide line numbers
diff --git m/pager.go m/pager.go index 0e22e83..51a007a 100644 --- m/pager.go +++ m/pager.go @@ -504,6 +504,16 @@ func (p *Pager) _OnSearchKey(logger *log.Logger, key tcell.Key) { } func (p *Pager) _MoveRight(delta int) { + if p.showLineNumbers && delta > 0 { + p.showLineNumbers = false + return + } + + if p.leftColumnZeroBased == 0 && delta < 0 { + p.showLineNumbers = true + return + } + result := p.leftColumnZeroBased + delta if result < 0 { p.leftColumnZeroBased = 0 Change-Id: I69040ac8da06e50b866fdb6b678a0ae54fe0a84f
This commit is contained in:
parent
7de5025257
commit
2e931b400c
10
m/pager.go
10
m/pager.go
@ -504,6 +504,16 @@ func (p *Pager) _OnSearchKey(logger *log.Logger, key tcell.Key) {
|
||||
}
|
||||
|
||||
func (p *Pager) _MoveRight(delta int) {
|
||||
if p.showLineNumbers && delta > 0 {
|
||||
p.showLineNumbers = false
|
||||
return
|
||||
}
|
||||
|
||||
if p.leftColumnZeroBased == 0 && delta < 0 {
|
||||
p.showLineNumbers = true
|
||||
return
|
||||
}
|
||||
|
||||
result := p.leftColumnZeroBased + delta
|
||||
if result < 0 {
|
||||
p.leftColumnZeroBased = 0
|
||||
|
Loading…
Reference in New Issue
Block a user