Skip to content

Commit

Permalink
Fix a crash on 32 bit systems
Browse files Browse the repository at this point in the history
Fixes #18
diff --git m/pager.go m/pager.go
index 178c828..b7cce09 100644
--- m/pager.go
+++ m/pager.go
@@ -3,7 +3,6 @@ package m
 import (
 	"fmt"
 	"log"
-	"math"
 	"os"
 	"regexp"
 	"time"
@@ -507,7 +506,7 @@ func (p *Pager) _OnKey(logger *log.Logger, key tcell.Key) {
 		p.firstLineOneBased = 1

 	case tcell.KeyEnd:
-		p.firstLineOneBased = math.MaxInt32
+		p.firstLineOneBased = p.reader.GetLineCount()

 	case tcell.KeyPgDn:
 		_, height := p.screen.Size()
@@ -565,7 +564,7 @@ func (p *Pager) _OnRune(logger *log.Logger, char rune) {
 		p.firstLineOneBased = 1

 	case '>', 'G':
-		p.firstLineOneBased = math.MaxInt32
+		p.firstLineOneBased = p.reader.GetLineCount()

 	case 'f', ' ':
 		_, height := p.screen.Size()

Change-Id: I17712d93322703ae3fa5b54a5a07169ddd1357c4
  • Loading branch information
walles committed Nov 13, 2019
1 parent 8a8f583 commit b0cf8bc
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions m/pager.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package m
import (
"fmt"
"log"
"math"
"os"
"regexp"
"time"
Expand Down Expand Up @@ -507,7 +506,7 @@ func (p *Pager) _OnKey(logger *log.Logger, key tcell.Key) {
p.firstLineOneBased = 1

case tcell.KeyEnd:
p.firstLineOneBased = math.MaxInt32
p.firstLineOneBased = p.reader.GetLineCount()

case tcell.KeyPgDn:
_, height := p.screen.Size()
Expand Down Expand Up @@ -565,7 +564,7 @@ func (p *Pager) _OnRune(logger *log.Logger, char rune) {
p.firstLineOneBased = 1

case '>', 'G':
p.firstLineOneBased = math.MaxInt32
p.firstLineOneBased = p.reader.GetLineCount()

case 'f', ' ':
_, height := p.screen.Size()
Expand Down

0 comments on commit b0cf8bc

Please sign in to comment.