Skip to content

Commit

Permalink
Fix: #338 hangup: svn blame FILENAME | more | gvim -
Browse files Browse the repository at this point in the history
  • Loading branch information
hymkor committed Oct 31, 2018
1 parent c5d977e commit 468ddd5
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions commands/more.go
Expand Up @@ -6,10 +6,13 @@ import (
"errors"
"fmt"
"io"
"math"
"os"
"regexp"

"github.com/mattn/go-isatty"
"github.com/mattn/go-runewidth"

"github.com/zetamatta/go-box"
"github.com/zetamatta/go-getch"
"github.com/zetamatta/go-texts/mbcs"
Expand All @@ -25,6 +28,11 @@ func more(_r io.Reader, cmd Param) bool {
r := mbcs.NewAutoDetectReader(_r, mbcs.ConsoleCP())
scanner := bufio.NewScanner(r)
count := 0

if f, ok := cmd.Out().(*os.File); !ok || !isatty.IsTerminal(f.Fd()) {
screenHeight = math.MaxInt32
}

for scanner.Scan() {
text := scanner.Text()
width := runewidth.StringWidth(ansiStrip.ReplaceAllString(text, ""))
Expand Down

0 comments on commit 468ddd5

Please sign in to comment.