mirror of
https://github.com/walles/moar.git
synced 2024-08-17 07:50:35 +03:00
Enable revive for unused parameters check
This commit is contained in:
parent
4475ce5c63
commit
f0bc8f2258
@ -1,9 +1,5 @@
|
|||||||
linters:
|
linters:
|
||||||
enable:
|
enable:
|
||||||
- gofmt
|
- gofmt
|
||||||
|
- revive
|
||||||
# I'd really want to use Revive for this but that doesn't work:
|
|
||||||
# https://github.com/golangci/golangci-lint/issues/3653
|
|
||||||
- unparam
|
|
||||||
|
|
||||||
- usestdlibvars
|
- usestdlibvars
|
||||||
|
@ -41,6 +41,7 @@ func TestTokenize(t *testing.T) {
|
|||||||
}()
|
}()
|
||||||
|
|
||||||
myReader := NewReaderFromStream(fileName, file)
|
myReader := NewReaderFromStream(fileName, file)
|
||||||
|
//revive:disable-next-line:empty-block
|
||||||
for !myReader.done.Load() {
|
for !myReader.done.Load() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,6 +12,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// Files larger than this won't be highlighted
|
// Files larger than this won't be highlighted
|
||||||
|
//
|
||||||
|
//revive:disable-next-line:var-naming
|
||||||
const MAX_HIGHLIGHT_SIZE int64 = 1024 * 1024
|
const MAX_HIGHLIGHT_SIZE int64 = 1024 * 1024
|
||||||
|
|
||||||
// Read and highlight a file using Chroma: https://github.com/alecthomas/chroma
|
// Read and highlight a file using Chroma: https://github.com/alecthomas/chroma
|
||||||
|
@ -8,6 +8,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// From: https://www.compart.com/en/unicode/U+00A0
|
// From: https://www.compart.com/en/unicode/U+00A0
|
||||||
|
//
|
||||||
|
//revive:disable-next-line:var-naming
|
||||||
const NO_BREAK_SPACE = '\xa0'
|
const NO_BREAK_SPACE = '\xa0'
|
||||||
|
|
||||||
func getWrapWidth(line []twin.Cell, maxWrapWidth int) int {
|
func getWrapWidth(line []twin.Cell, maxWrapWidth int) int {
|
||||||
|
@ -24,8 +24,11 @@ const (
|
|||||||
type StatusBarOption int
|
type StatusBarOption int
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
//revive:disable-next-line:var-naming
|
||||||
STATUSBAR_STYLE_INVERSE StatusBarOption = iota
|
STATUSBAR_STYLE_INVERSE StatusBarOption = iota
|
||||||
|
//revive:disable-next-line:var-naming
|
||||||
STATUSBAR_STYLE_PLAIN
|
STATUSBAR_STYLE_PLAIN
|
||||||
|
//revive:disable-next-line:var-naming
|
||||||
STATUSBAR_STYLE_BOLD
|
STATUSBAR_STYLE_BOLD
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -33,7 +36,9 @@ const (
|
|||||||
type UnprintableStyle int
|
type UnprintableStyle int
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
//revive:disable-next-line:var-naming
|
||||||
UNPRINTABLE_STYLE_HIGHLIGHT UnprintableStyle = iota
|
UNPRINTABLE_STYLE_HIGHLIGHT UnprintableStyle = iota
|
||||||
|
//revive:disable-next-line:var-naming
|
||||||
UNPRINTABLE_STYLE_WHITESPACE
|
UNPRINTABLE_STYLE_WHITESPACE
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -475,7 +480,7 @@ func (p *Pager) StartPaging(screen twin.Screen, chromaStyle *chroma.Style, chrom
|
|||||||
|
|
||||||
unprintableStyle = p.UnprintableStyle
|
unprintableStyle = p.UnprintableStyle
|
||||||
consumeLessTermcapEnvs(chromaStyle, chromaFormatter)
|
consumeLessTermcapEnvs(chromaStyle, chromaFormatter)
|
||||||
styleUi(chromaStyle, chromaFormatter, p.StatusBarStyle)
|
styleUI(chromaStyle, chromaFormatter, p.StatusBarStyle)
|
||||||
|
|
||||||
p.screen = screen
|
p.screen = screen
|
||||||
p.linePrefix = getLineColorPrefix(chromaStyle, chromaFormatter)
|
p.linePrefix = getLineColorPrefix(chromaStyle, chromaFormatter)
|
||||||
|
@ -15,6 +15,8 @@ import (
|
|||||||
"gotest.tools/v3/assert"
|
"gotest.tools/v3/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
//revive:disable:empty-block
|
||||||
|
|
||||||
const blueBackgroundClearToEol0 = "\x1b[44m\x1b[0K" // With 0 before the K, should clear to EOL
|
const blueBackgroundClearToEol0 = "\x1b[44m\x1b[0K" // With 0 before the K, should clear to EOL
|
||||||
const blueBackgroundClearToEol = "\x1b[44m\x1b[K" // No 0 before the K, should also clear to EOL
|
const blueBackgroundClearToEol = "\x1b[44m\x1b[K" // No 0 before the K, should also clear to EOL
|
||||||
|
|
||||||
|
58
m/reader.go
58
m/reader.go
@ -465,58 +465,58 @@ func NewReaderFromFilename(filename string, style chroma.Style, formatter chroma
|
|||||||
}
|
}
|
||||||
|
|
||||||
// createStatusUnlocked() assumes that its caller is holding the lock
|
// createStatusUnlocked() assumes that its caller is holding the lock
|
||||||
func (r *Reader) createStatusUnlocked(lastLineOneBased int) string {
|
func (reader *Reader) createStatusUnlocked(lastLineOneBased int) string {
|
||||||
prefix := ""
|
prefix := ""
|
||||||
if r.name != nil {
|
if reader.name != nil {
|
||||||
prefix = path.Base(*r.name) + ": "
|
prefix = path.Base(*reader.name) + ": "
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(r.lines) == 0 {
|
if len(reader.lines) == 0 {
|
||||||
return prefix + "<empty>"
|
return prefix + "<empty>"
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(r.lines) == 1 {
|
if len(reader.lines) == 1 {
|
||||||
return prefix + "1 line 100%"
|
return prefix + "1 line 100%"
|
||||||
}
|
}
|
||||||
|
|
||||||
percent := int(100 * float64(lastLineOneBased) / float64(len(r.lines)))
|
percent := int(100 * float64(lastLineOneBased) / float64(len(reader.lines)))
|
||||||
|
|
||||||
return fmt.Sprintf("%s%s lines %d%%",
|
return fmt.Sprintf("%s%s lines %d%%",
|
||||||
prefix,
|
prefix,
|
||||||
formatNumber(uint(len(r.lines))),
|
formatNumber(uint(len(reader.lines))),
|
||||||
percent)
|
percent)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetLineCount returns the number of lines available for viewing
|
// GetLineCount returns the number of lines available for viewing
|
||||||
func (r *Reader) GetLineCount() int {
|
func (reader *Reader) GetLineCount() int {
|
||||||
r.Lock()
|
reader.Lock()
|
||||||
defer r.Unlock()
|
defer reader.Unlock()
|
||||||
|
|
||||||
return len(r.lines)
|
return len(reader.lines)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetLine gets a line. If the requested line number is out of bounds, nil is returned.
|
// GetLine gets a line. If the requested line number is out of bounds, nil is returned.
|
||||||
func (r *Reader) GetLine(lineNumberOneBased int) *Line {
|
func (reader *Reader) GetLine(lineNumberOneBased int) *Line {
|
||||||
r.Lock()
|
reader.Lock()
|
||||||
defer r.Unlock()
|
defer reader.Unlock()
|
||||||
|
|
||||||
if lineNumberOneBased < 1 {
|
if lineNumberOneBased < 1 {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if lineNumberOneBased > len(r.lines) {
|
if lineNumberOneBased > len(reader.lines) {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return r.lines[lineNumberOneBased-1]
|
return reader.lines[lineNumberOneBased-1]
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetLines gets the indicated lines from the input
|
// GetLines gets the indicated lines from the input
|
||||||
//
|
//
|
||||||
// Overflow state will be didFit if we returned all lines we currently have, or
|
// Overflow state will be didFit if we returned all lines we currently have, or
|
||||||
// didOverflow otherwise.
|
// didOverflow otherwise.
|
||||||
func (r *Reader) GetLines(firstLineOneBased int, wantedLineCount int) (*InputLines, overflowState) {
|
func (reader *Reader) GetLines(firstLineOneBased int, wantedLineCount int) (*InputLines, overflowState) {
|
||||||
r.Lock()
|
reader.Lock()
|
||||||
defer r.Unlock()
|
defer reader.Unlock()
|
||||||
return r.getLinesUnlocked(firstLineOneBased, wantedLineCount)
|
return reader.getLinesUnlocked(firstLineOneBased, wantedLineCount)
|
||||||
}
|
}
|
||||||
|
|
||||||
func nonWrappingAdd(a int, b int) int {
|
func nonWrappingAdd(a int, b int) int {
|
||||||
@ -531,16 +531,16 @@ func nonWrappingAdd(a int, b int) int {
|
|||||||
return a + b
|
return a + b
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *Reader) getLinesUnlocked(firstLineOneBased int, wantedLineCount int) (*InputLines, overflowState) {
|
func (reader *Reader) getLinesUnlocked(firstLineOneBased int, wantedLineCount int) (*InputLines, overflowState) {
|
||||||
if firstLineOneBased < 1 {
|
if firstLineOneBased < 1 {
|
||||||
firstLineOneBased = 1
|
firstLineOneBased = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(r.lines) == 0 || wantedLineCount == 0 {
|
if len(reader.lines) == 0 || wantedLineCount == 0 {
|
||||||
return &InputLines{
|
return &InputLines{
|
||||||
lines: nil,
|
lines: nil,
|
||||||
firstLineOneBased: firstLineOneBased,
|
firstLineOneBased: firstLineOneBased,
|
||||||
statusText: r.createStatusUnlocked(firstLineOneBased),
|
statusText: reader.createStatusUnlocked(firstLineOneBased),
|
||||||
},
|
},
|
||||||
didFit // Empty files always fit
|
didFit // Empty files always fit
|
||||||
}
|
}
|
||||||
@ -548,8 +548,8 @@ func (r *Reader) getLinesUnlocked(firstLineOneBased int, wantedLineCount int) (*
|
|||||||
firstLineZeroBased := firstLineOneBased - 1
|
firstLineZeroBased := firstLineOneBased - 1
|
||||||
lastLineZeroBased := nonWrappingAdd(firstLineZeroBased, wantedLineCount-1)
|
lastLineZeroBased := nonWrappingAdd(firstLineZeroBased, wantedLineCount-1)
|
||||||
|
|
||||||
if lastLineZeroBased >= len(r.lines) {
|
if lastLineZeroBased >= len(reader.lines) {
|
||||||
lastLineZeroBased = len(r.lines) - 1
|
lastLineZeroBased = len(reader.lines) - 1
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prevent reading past the end of the available lines
|
// Prevent reading past the end of the available lines
|
||||||
@ -561,19 +561,19 @@ func (r *Reader) getLinesUnlocked(firstLineOneBased int, wantedLineCount int) (*
|
|||||||
firstLineOneBased = 1
|
firstLineOneBased = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
return r.getLinesUnlocked(firstLineOneBased, wantedLineCount)
|
return reader.getLinesUnlocked(firstLineOneBased, wantedLineCount)
|
||||||
}
|
}
|
||||||
|
|
||||||
returnLines := r.lines[firstLineZeroBased : lastLineZeroBased+1]
|
returnLines := reader.lines[firstLineZeroBased : lastLineZeroBased+1]
|
||||||
overflow := didFit
|
overflow := didFit
|
||||||
if len(returnLines) != len(r.lines) {
|
if len(returnLines) != len(reader.lines) {
|
||||||
overflow = didOverflow // We're not returning all available lines
|
overflow = didOverflow // We're not returning all available lines
|
||||||
}
|
}
|
||||||
|
|
||||||
return &InputLines{
|
return &InputLines{
|
||||||
lines: returnLines,
|
lines: returnLines,
|
||||||
firstLineOneBased: firstLineOneBased,
|
firstLineOneBased: firstLineOneBased,
|
||||||
statusText: r.createStatusUnlocked(lastLineZeroBased + 1),
|
statusText: reader.createStatusUnlocked(lastLineZeroBased + 1),
|
||||||
},
|
},
|
||||||
overflow
|
overflow
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,8 @@ import (
|
|||||||
"gotest.tools/v3/assert"
|
"gotest.tools/v3/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
//revive:disable:empty-block
|
||||||
|
|
||||||
func testGetLineCount(t *testing.T, reader *Reader) {
|
func testGetLineCount(t *testing.T, reader *Reader) {
|
||||||
if strings.Contains(*reader.name, "compressed") {
|
if strings.Contains(*reader.name, "compressed") {
|
||||||
// We are no good at counting lines of compressed files, never mind
|
// We are no good at counting lines of compressed files, never mind
|
||||||
@ -139,8 +141,10 @@ func getTestFiles() []string {
|
|||||||
// Wait for reader to finish reading and highlighting. Used by tests.
|
// Wait for reader to finish reading and highlighting. Used by tests.
|
||||||
func (r *Reader) _wait() error {
|
func (r *Reader) _wait() error {
|
||||||
// Wait for our goroutine to finish
|
// Wait for our goroutine to finish
|
||||||
|
//revive:disable-next-line:empty-block
|
||||||
for !r.done.Load() {
|
for !r.done.Load() {
|
||||||
}
|
}
|
||||||
|
//revive:disable-next-line:empty-block
|
||||||
for !r.highlightingDone.Load() {
|
for !r.highlightingDone.Load() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -213,7 +217,7 @@ func testHighlightingLineCount(t *testing.T, filenameWithPath string) {
|
|||||||
}
|
}
|
||||||
rawLinesCount := rawLinefeedsCount
|
rawLinesCount := rawLinefeedsCount
|
||||||
if !rawFileEndsWithNewline {
|
if !rawFileEndsWithNewline {
|
||||||
rawLinesCount += 1
|
rawLinesCount++
|
||||||
}
|
}
|
||||||
|
|
||||||
// Then load the same file using one of our Readers
|
// Then load the same file using one of our Readers
|
||||||
@ -329,15 +333,15 @@ func TestCompressedFiles(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestFilterNotInstalled(t *testing.T) {
|
func TestFilterNotInstalled(t *testing.T) {
|
||||||
// FIXME: Test what happens if we try to use a filter that is not installed
|
t.Skip("FIXME: Test what happens if we try to use a filter that is not installed")
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestFilterFailure(t *testing.T) {
|
func TestFilterFailure(t *testing.T) {
|
||||||
// FIXME: Test what happens if the filter command fails because of bad command line options
|
t.Skip("FIXME: Test what happens if the filter command fails because of bad command line options")
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestFilterPermissionDenied(t *testing.T) {
|
func TestFilterPermissionDenied(t *testing.T) {
|
||||||
// FIXME: Test what happens if the filter command fails because it can't access the requested file
|
t.Skip("FIXME: Test what happens if the filter command fails because it can't access the requested file")
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestFilterFileNotFound(t *testing.T) {
|
func TestFilterFileNotFound(t *testing.T) {
|
||||||
@ -357,7 +361,7 @@ func TestFilterFileNotFound(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestFilterNotAFile(t *testing.T) {
|
func TestFilterNotAFile(t *testing.T) {
|
||||||
// FIXME: Test what happens if the filter command fails because the target is not a file
|
t.Skip("FIXME: Test what happens if the filter command fails because the target is not a file")
|
||||||
}
|
}
|
||||||
|
|
||||||
// How long does it take to read a file?
|
// How long does it take to read a file?
|
||||||
@ -376,6 +380,7 @@ func BenchmarkReaderDone(b *testing.B) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Wait for the reader to finish
|
// Wait for the reader to finish
|
||||||
|
//revive:disable-next-line:empty-block
|
||||||
for !readMe.done.Load() {
|
for !readMe.done.Load() {
|
||||||
}
|
}
|
||||||
if readMe.err != nil {
|
if readMe.err != nil {
|
||||||
@ -390,8 +395,8 @@ func BenchmarkReadLargeFile(b *testing.B) {
|
|||||||
const largeSizeBytes = 35_000_000
|
const largeSizeBytes = 35_000_000
|
||||||
|
|
||||||
// First, create it from something...
|
// First, create it from something...
|
||||||
input_filename := getSamplesDir() + "/../m/pager.go"
|
inputFilename := getSamplesDir() + "/../m/pager.go"
|
||||||
contents, err := os.ReadFile(input_filename)
|
contents, err := os.ReadFile(inputFilename)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
@ -436,8 +441,8 @@ func BenchmarkReadLargeFile(b *testing.B) {
|
|||||||
// Count lines in pager.go
|
// Count lines in pager.go
|
||||||
func BenchmarkCountLines(b *testing.B) {
|
func BenchmarkCountLines(b *testing.B) {
|
||||||
// First, get some sample lines...
|
// First, get some sample lines...
|
||||||
input_filename := getSamplesDir() + "/../m/pager.go"
|
inputFilename := getSamplesDir() + "/../m/pager.go"
|
||||||
contents, err := os.ReadFile(input_filename)
|
contents, err := os.ReadFile(inputFilename)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,8 @@ import (
|
|||||||
"gotest.tools/v3/assert"
|
"gotest.tools/v3/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
//revive:disable:empty-block
|
||||||
|
|
||||||
func testHorizontalCropping(t *testing.T, contents string, firstIndex int, lastIndex int, expected string, expectedOverflow overflowState) {
|
func testHorizontalCropping(t *testing.T, contents string, firstIndex int, lastIndex int, expected string, expectedOverflow overflowState) {
|
||||||
pager := NewPager(nil)
|
pager := NewPager(nil)
|
||||||
pager.ShowLineNumbers = false
|
pager.ShowLineNumbers = false
|
||||||
|
@ -60,23 +60,23 @@ func canonicalFromPager(pager *Pager) scrollPositionCanonical {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create a new position, scrolled towards the end of the file
|
// Create a new position, scrolled towards the end of the file
|
||||||
func (s scrollPosition) PreviousLine(scrollDistance int) scrollPosition {
|
func (sp scrollPosition) PreviousLine(scrollDistance int) scrollPosition {
|
||||||
return scrollPosition{
|
return scrollPosition{
|
||||||
internalDontTouch: scrollPositionInternal{
|
internalDontTouch: scrollPositionInternal{
|
||||||
name: s.internalDontTouch.name,
|
name: sp.internalDontTouch.name,
|
||||||
lineNumberOneBased: s.internalDontTouch.lineNumberOneBased,
|
lineNumberOneBased: sp.internalDontTouch.lineNumberOneBased,
|
||||||
deltaScreenLines: s.internalDontTouch.deltaScreenLines - scrollDistance,
|
deltaScreenLines: sp.internalDontTouch.deltaScreenLines - scrollDistance,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a new position, scrolled towards the end of the file
|
// Create a new position, scrolled towards the end of the file
|
||||||
func (s scrollPosition) NextLine(scrollDistance int) scrollPosition {
|
func (sp scrollPosition) NextLine(scrollDistance int) scrollPosition {
|
||||||
return scrollPosition{
|
return scrollPosition{
|
||||||
internalDontTouch: scrollPositionInternal{
|
internalDontTouch: scrollPositionInternal{
|
||||||
name: s.internalDontTouch.name,
|
name: sp.internalDontTouch.name,
|
||||||
lineNumberOneBased: s.internalDontTouch.lineNumberOneBased,
|
lineNumberOneBased: sp.internalDontTouch.lineNumberOneBased,
|
||||||
deltaScreenLines: s.internalDontTouch.deltaScreenLines + scrollDistance,
|
deltaScreenLines: sp.internalDontTouch.deltaScreenLines + scrollDistance,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -168,7 +168,7 @@ func (si *scrollPositionInternal) emptyBottomLinesCount(pager *Pager) int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Move to the next line
|
// Move to the next line
|
||||||
lineNumberOneBased += 1
|
lineNumberOneBased++
|
||||||
}
|
}
|
||||||
|
|
||||||
return unclaimedViewportLines
|
return unclaimedViewportLines
|
||||||
|
@ -70,9 +70,9 @@ func (p *Pager) findFirstHit(startPosition scrollPosition, backwards bool) *scro
|
|||||||
}
|
}
|
||||||
|
|
||||||
if backwards {
|
if backwards {
|
||||||
searchPosition -= 1
|
searchPosition--
|
||||||
} else {
|
} else {
|
||||||
searchPosition += 1
|
searchPosition++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -138,7 +138,7 @@ func (s *styledStringSplitter) consumeControlSequence(charAfterEsc rune) error {
|
|||||||
|
|
||||||
if charAfterEsc == ']' && s.input[startIndex:s.nextByteIndex] == "8;;" {
|
if charAfterEsc == ']' && s.input[startIndex:s.nextByteIndex] == "8;;" {
|
||||||
// Special case, here comes the URL
|
// Special case, here comes the URL
|
||||||
return s.handleUrl()
|
return s.handleURL()
|
||||||
}
|
}
|
||||||
|
|
||||||
continue
|
continue
|
||||||
@ -196,9 +196,9 @@ func (s *styledStringSplitter) handleOsc(sequence string) error {
|
|||||||
if endMarker == esc {
|
if endMarker == esc {
|
||||||
if s.nextChar() == '\\' {
|
if s.nextChar() == '\\' {
|
||||||
return nil
|
return nil
|
||||||
} else {
|
|
||||||
return fmt.Errorf("Expected ESC \\ after ESC]133;X, got %q", s.lastChar())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return fmt.Errorf("Expected ESC \\ after ESC]133;X, got %q", s.lastChar())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -206,7 +206,7 @@ func (s *styledStringSplitter) handleOsc(sequence string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// We just got ESC]8; and should now read the URL. URLs end with ASCII 7 BEL or ESC \.
|
// We just got ESC]8; and should now read the URL. URLs end with ASCII 7 BEL or ESC \.
|
||||||
func (s *styledStringSplitter) handleUrl() error {
|
func (s *styledStringSplitter) handleURL() error {
|
||||||
// Valid URL characters.
|
// Valid URL characters.
|
||||||
// Ref: https://stackoverflow.com/a/1547940/473672
|
// Ref: https://stackoverflow.com/a/1547940/473672
|
||||||
const validChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~:/?#[]@!$&'()*+,;="
|
const validChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~:/?#[]@!$&'()*+,;="
|
||||||
|
@ -11,7 +11,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// From LESS_TERMCAP_so, overrides statusbarStyle from the Chroma style if set
|
// From LESS_TERMCAP_so, overrides statusbarStyle from the Chroma style if set
|
||||||
var standoutStyle *twin.Style = nil
|
var standoutStyle *twin.Style
|
||||||
|
|
||||||
var manPageBold = twin.StyleDefault.WithAttr(twin.AttrBold)
|
var manPageBold = twin.StyleDefault.WithAttr(twin.AttrBold)
|
||||||
var manPageUnderline = twin.StyleDefault.WithAttr(twin.AttrUnderline)
|
var manPageUnderline = twin.StyleDefault.WithAttr(twin.AttrUnderline)
|
||||||
@ -75,7 +75,7 @@ func consumeLessTermcapEnvs(chromaStyle *chroma.Style, chromaFormatter *chroma.F
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func styleUi(chromaStyle *chroma.Style, chromaFormatter *chroma.Formatter, statusbarOption StatusBarOption) {
|
func styleUI(chromaStyle *chroma.Style, chromaFormatter *chroma.Formatter, statusbarOption StatusBarOption) {
|
||||||
if chromaStyle == nil || chromaFormatter == nil {
|
if chromaStyle == nil || chromaFormatter == nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user