From 67acc6b5b053677a1a09b2502f6b614c0767ac18 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Mon, 6 May 2024 20:37:58 +0900 Subject: [PATCH] cleanup --- src/terminal.go | 9 ++------- src/tui/light.go | 4 ++-- src/tui/light_unix.go | 2 +- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/terminal.go b/src/terminal.go index d947ab56..9d0bd577 100644 --- a/src/terminal.go +++ b/src/terminal.go @@ -53,7 +53,6 @@ var offsetTrimCharsRegex *regexp.Regexp var activeTempFiles []string var activeTempFilesMutex sync.Mutex var passThroughRegex *regexp.Regexp -var actionTypeRegex *regexp.Regexp const clearCode string = "\x1b[2J" @@ -2117,12 +2116,11 @@ func (t *Terminal) renderPreviewArea(unchanged bool) { } height := t.pwindow.Height() - header := []string{} body := t.previewer.lines headerLines := t.previewOpts.headerLines // Do not enable preview header lines if it's value is too large if headerLines > 0 && headerLines < util.Min(len(body), height) { - header = t.previewer.lines[0:headerLines] + header := t.previewer.lines[0:headerLines] body = t.previewer.lines[headerLines:] // Always redraw header t.renderPreviewText(height, header, 0, false) @@ -2499,8 +2497,6 @@ func parsePlaceholder(match string) (bool, string, placeholderFlags) { case 'q': flags.forceUpdate = true // query flag is not skipped - default: - break } } @@ -3430,8 +3426,7 @@ func (t *Terminal) Loop() error { } var doAction func(*action) bool - var doActions func(actions []*action) bool - doActions = func(actions []*action) bool { + doActions := func(actions []*action) bool { for iter := 0; iter <= maxFocusEvents; iter++ { currentIndex := t.currentIndex() for _, action := range actions { diff --git a/src/tui/light.go b/src/tui/light.go index 521d9171..84a4c701 100644 --- a/src/tui/light.go +++ b/src/tui/light.go @@ -251,7 +251,7 @@ func (r *LightRenderer) getBytesInternal(buffer []byte, nonblock bool) ([]byte, c, ok := r.getch(nonblock) if !nonblock && !ok { r.Close() - return nil, errors.New("Failed to read " + consoleDevice) + return nil, errors.New("failed to read " + consoleDevice) } retries := 0 @@ -282,7 +282,7 @@ func (r *LightRenderer) getBytesInternal(buffer []byte, nonblock bool) ([]byte, // so terminate fzf immediately. if len(buffer) > maxInputBuffer { r.Close() - return nil, fmt.Errorf("Input buffer overflow (%d): %v", len(buffer), buffer) + return nil, fmt.Errorf("input buffer overflow (%d): %v", len(buffer), buffer) } } diff --git a/src/tui/light_unix.go b/src/tui/light_unix.go index f8cb32af..a5499a00 100644 --- a/src/tui/light_unix.go +++ b/src/tui/light_unix.go @@ -57,7 +57,7 @@ func openTtyIn() (*os.File, error) { return in, nil } } - return nil, errors.New("Failed to open " + consoleDevice) + return nil, errors.New("failed to open " + consoleDevice) } return in, nil }