From 9a4fbb3be1661fd8ffdcd580581c99500a834135 Mon Sep 17 00:00:00 2001 From: Christian Muehlhaeuser Date: Sat, 22 Aug 2020 12:41:09 +0200 Subject: [PATCH] Make golint happy --- paginator/paginator.go | 2 +- textinput/textinput.go | 8 ++------ viewport/viewport.go | 5 +---- 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/paginator/paginator.go b/paginator/paginator.go index be6a148..d3c17b0 100644 --- a/paginator/paginator.go +++ b/paginator/paginator.go @@ -13,7 +13,7 @@ import ( // Type specifies the way we render pagination. type Type int -// Pagination rendering options +// Pagination rendering options. const ( Arabic Type = iota Dots diff --git a/textinput/textinput.go b/textinput/textinput.go index 2ea3ad9..801bf6a 100644 --- a/textinput/textinput.go +++ b/textinput/textinput.go @@ -16,7 +16,7 @@ const ( ) var ( - // color is a helper for returning colors + // color is a helper for returning colors. color func(s string) termenv.Color = termenv.ColorProfile().Color ) @@ -181,7 +181,6 @@ func (m *Model) handleOverflow() { m.offsetRight = min(m.offsetRight, len(m.value)) if m.pos < m.offset { - m.offset = m.pos w := 0 @@ -196,9 +195,7 @@ func (m *Model) handleOverflow() { } m.offsetRight = m.offset + i - } else if m.pos >= m.offsetRight { - m.offsetRight = m.pos w := 0 @@ -213,7 +210,6 @@ func (m *Model) handleOverflow() { } m.offset = m.offsetRight - (len(runes) - 1 - i) - } } @@ -440,7 +436,7 @@ func View(model tea.Model) string { return m.Prompt + v } -// placeholderView +// placeholderView. func placeholderView(m Model) string { var ( v string diff --git a/viewport/viewport.go b/viewport/viewport.go index d2bbd23..d62d84e 100644 --- a/viewport/viewport.go +++ b/viewport/viewport.go @@ -73,7 +73,7 @@ func (m *Model) SetContent(s string) { m.lines = strings.Split(s, "\n") } -// Return the lines that should currently be visible in the viewport +// Return the lines that should currently be visible in the viewport. func (m Model) visibleLines() (lines []string) { if len(m.lines) > 0 { top := max(0, m.YOffset) @@ -287,7 +287,6 @@ func Update(msg tea.Msg, m Model) (Model, tea.Cmd) { var cmd tea.Cmd switch msg := msg.(type) { - case tea.KeyMsg: switch msg.String() { // Down one page @@ -335,7 +334,6 @@ func Update(msg tea.Msg, m Model) (Model, tea.Cmd) { case tea.MouseMsg: switch msg.Button { - case tea.MouseWheelUp: lines := m.LineUp(3) if m.HighPerformanceRendering { @@ -357,7 +355,6 @@ func Update(msg tea.Msg, m Model) (Model, tea.Cmd) { // View renders the viewport into a string. func View(m Model) string { - if m.HighPerformanceRendering { // Just send newlines since we're doing to be rendering the actual // content seprately. We still need send something that equals the