From b296cbb78020ab0546323f90348b5945dea80e05 Mon Sep 17 00:00:00 2001 From: Christian Rocha Date: Tue, 25 Aug 2020 11:00:05 -0400 Subject: [PATCH] Remove newlines the linter is complaining about --- ui/pager.go | 4 ---- ui/stash.go | 9 --------- ui/ui.go | 4 ---- 3 files changed, 17 deletions(-) diff --git a/ui/pager.go b/ui/pager.go index e34b3bb..1489c71 100644 --- a/ui/pager.go +++ b/ui/pager.go @@ -115,7 +115,6 @@ type pagerModel struct { } func newPagerModel(glamourStyle string) pagerModel { - // Init viewport vp := viewport.Model{} vp.YPosition = 0 @@ -176,7 +175,6 @@ func (m *pagerModel) toggleHelp() { // that the the returned command should be sent back the through the pager // update function. func (m *pagerModel) showStatusMessage(statusMessage string) tea.Cmd { - // Show a success message to the user m.state = pagerStateStatusMessage m.statusMessageHeader = statusMessage @@ -211,7 +209,6 @@ func pagerUpdate(msg tea.Msg, m pagerModel) (pagerModel, tea.Cmd) { ) switch msg := msg.(type) { - case tea.KeyMsg: switch m.state { case pagerStateSetNote: @@ -507,7 +504,6 @@ func renderWithGlamour(m pagerModel, md string) tea.Cmd { // This is where the magic happens. func glamourRender(m pagerModel, markdown string) (string, error) { - if !config.GlamourEnabled { return markdown, nil } diff --git a/ui/stash.go b/ui/stash.go index 961b170..688b3dd 100644 --- a/ui/stash.go +++ b/ui/stash.go @@ -284,7 +284,6 @@ func stashUpdate(msg tea.Msg, m stashModel) (stashModel, tea.Cmd) { var cmds []tea.Cmd switch msg := msg.(type) { - case errMsg: m.err = msg @@ -373,13 +372,10 @@ func stashUpdate(msg tea.Msg, m stashModel) (stashModel, tea.Cmd) { switch m.state { case stashStateReady: - switch msg := msg.(type) { - // Handle keys case tea.KeyMsg: switch msg.String() { - case "k", "up": m.index-- if m.index < 0 && m.paginator.Page == 0 { @@ -483,7 +479,6 @@ func stashUpdate(msg tea.Msg, m stashModel) (stashModel, tea.Cmd) { m.state = stashStateShowingError return m, nil } - } } @@ -523,7 +518,6 @@ func stashUpdate(msg tea.Msg, m stashModel) (stashModel, tea.Cmd) { case stashStatePromptDelete: if msg, ok := msg.(tea.KeyMsg); ok { switch msg.String() { - // Confirm deletion case "y": if m.state != stashStatePromptDelete { @@ -586,7 +580,6 @@ func stashUpdate(msg tea.Msg, m stashModel) (stashModel, tea.Cmd) { if _, ok := msg.(tea.KeyMsg); ok { m.state = stashStateReady } - } // If an item is being confirmed for delete, any key (other than the key @@ -598,7 +591,6 @@ func stashUpdate(msg tea.Msg, m stashModel) (stashModel, tea.Cmd) { // VIEW func stashView(m stashModel) string { - var s string switch m.state { case stashStateShowingError: @@ -796,7 +788,6 @@ func stashHelpViewBuilder(windowWidth int, sections ...string) string { ) for i := 0; i < len(sections); i++ { - // If we need this more often we'll formalize something rather than // use an if clause/switch here. switch sections[i] { diff --git a/ui/ui.go b/ui/ui.go index f61ecaf..d10b14e 100644 --- a/ui/ui.go +++ b/ui/ui.go @@ -215,7 +215,6 @@ func update(msg tea.Msg, mdl tea.Model) (tea.Model, tea.Cmd) { // Special cases for the pager case stateShowDocument: switch m.pager.state { - // If setting a note send all keys straight through case pagerStateSetNote: var batch []tea.Cmd @@ -236,7 +235,6 @@ func update(msg tea.Msg, mdl tea.Model) (tea.Model, tea.Cmd) { return m, tea.Batch(batch...) } } - } return m, tea.Quit @@ -348,7 +346,6 @@ func update(msg tea.Msg, mdl tea.Model) (tea.Model, tea.Cmd) { // Process children switch m.state { - case stateShowStash: newStashModel, cmd := stashUpdate(msg, m.stash) m.stash = newStashModel @@ -366,7 +363,6 @@ func update(msg tea.Msg, mdl tea.Model) (tea.Model, tea.Cmd) { // VIEW func view(mdl tea.Model) string { - m, ok := mdl.(model) if !ok { return "could not perform assertion on model in view"