1
1
mirror of https://github.com/walles/moar.git synced 2024-11-11 00:27:04 +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:
Johan Walles 2019-11-19 11:41:56 +01:00
parent 7de5025257
commit 2e931b400c

View File

@ -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