From 5fef5598de2d95a57650aea96f267828decb1d5b Mon Sep 17 00:00:00 2001 From: "Luke I. Wilson" Date: Mon, 15 Mar 2021 16:07:50 -0500 Subject: [PATCH] go fmt --- ui/textedit.go | 14 +++++++------- ui/theme.go | 32 ++++++++++++++++---------------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/ui/textedit.go b/ui/textedit.go index 4e319dc..7799913 100644 --- a/ui/textedit.go +++ b/ui/textedit.go @@ -36,8 +36,8 @@ type TextEdit struct { prevCurCol int // Previous maximum column the cursor was at, when the user pressed left or right scrollx, scrolly int // X and Y offset of view, known as scroll - selection Selection // Selection: nil is no selection - selectMode bool // Whether the user is actively selecting text + selection Selection // Selection: nil is no selection + selectMode bool // Whether the user is actively selecting text Theme *Theme } @@ -289,7 +289,7 @@ func (t *TextEdit) CursorUp() { if t.UseHardTabs { // When using hard tabs, subtract offsets produced by tabs tabOffset := t.getTabOffsetInLineAtCol(t.cury-1, t.prevCurCol) hardTabs := tabOffset / t.TabSize - col -= tabOffset-hardTabs // We still want to count each \t in the col + col -= tabOffset - hardTabs // We still want to count each \t in the col } line, col := t.clampLineCol(t.cury-1, col) t.SetLineCol(line, col) @@ -305,7 +305,7 @@ func (t *TextEdit) CursorDown() { if t.UseHardTabs { tabOffset := t.getTabOffsetInLineAtCol(t.cury+1, t.prevCurCol) hardTabs := tabOffset / t.TabSize - col -= tabOffset-hardTabs // We still want to count each \t in the col + col -= tabOffset - hardTabs // We still want to count each \t in the col } line, col := t.clampLineCol(t.cury+1, col) t.SetLineCol(line, col) // Go to line below @@ -320,7 +320,7 @@ func (t *TextEdit) CursorLeft() { t.SetLineCol(t.cury, t.curx-1) } tabOffset := t.getTabOffsetInLineAtCol(t.cury, t.curx) - t.prevCurCol = t.curx+tabOffset + t.prevCurCol = t.curx + tabOffset } // CursorRight moves the cursor right a column. @@ -457,10 +457,10 @@ func (t *TextEdit) HandleEvent(event tcell.Event) bool { // Reset the selection to cursor pos t.selection.StartLine, t.selection.StartCol = t.cury, t.curx t.selection.EndLine, t.selection.EndCol = t.cury, t.curx - t.selectMode = true + t.selectMode = true } t.CursorRight() // Advance the cursor - t.selection.EndLine, t.selection.EndCol = t.cury, t.curx + t.selection.EndLine, t.selection.EndCol = t.cury, t.curx } else { if t.selectMode { t.selectMode = false diff --git a/ui/theme.go b/ui/theme.go index 0daa0da..d9efe2e 100644 --- a/ui/theme.go +++ b/ui/theme.go @@ -29,20 +29,20 @@ func (theme *Theme) GetOrDefault(key string) tcell.Style { // DefaultTheme uses only the first 16 colors present in most colored terminals. var DefaultTheme = Theme{ - "Normal": tcell.Style{}.Foreground(tcell.ColorSilver).Background(tcell.ColorBlack), - "Button": tcell.Style{}.Foreground(tcell.ColorBlack).Background(tcell.ColorWhite), - "InputField": tcell.Style{}.Foreground(tcell.ColorWhite).Background(tcell.ColorBlack), - "MenuBar": tcell.Style{}.Foreground(tcell.ColorBlack).Background(tcell.ColorSilver), - "MenuBarSelected": tcell.Style{}.Foreground(tcell.ColorSilver).Background(tcell.ColorBlack), - "Menu": tcell.Style{}.Foreground(tcell.ColorBlack).Background(tcell.ColorSilver), - "MenuSelected": tcell.Style{}.Foreground(tcell.ColorSilver).Background(tcell.ColorBlack), - "QuickChar": tcell.Style{}.Foreground(tcell.ColorYellow).Background(tcell.ColorBlack), - "Tab": tcell.Style{}.Foreground(tcell.ColorSilver).Background(tcell.ColorBlack), - "TabContainer": tcell.Style{}.Foreground(tcell.ColorSilver).Background(tcell.ColorBlack), - "TabSelected": tcell.Style{}.Foreground(tcell.ColorBlack).Background(tcell.ColorSilver), - "TextEdit": tcell.Style{}.Foreground(tcell.ColorSilver).Background(tcell.ColorBlack), - "TextEditColumn": tcell.Style{}.Foreground(tcell.ColorBlack).Background(tcell.ColorGray), - "TextEditSelected":tcell.Style{}.Foreground(tcell.ColorBlack).Background(tcell.ColorSilver), - "Window": tcell.Style{}.Foreground(tcell.ColorBlack).Background(tcell.ColorSilver), - "WindowHeader": tcell.Style{}.Foreground(tcell.ColorBlack).Background(tcell.ColorWhite), + "Normal": tcell.Style{}.Foreground(tcell.ColorSilver).Background(tcell.ColorBlack), + "Button": tcell.Style{}.Foreground(tcell.ColorBlack).Background(tcell.ColorWhite), + "InputField": tcell.Style{}.Foreground(tcell.ColorWhite).Background(tcell.ColorBlack), + "MenuBar": tcell.Style{}.Foreground(tcell.ColorBlack).Background(tcell.ColorSilver), + "MenuBarSelected": tcell.Style{}.Foreground(tcell.ColorSilver).Background(tcell.ColorBlack), + "Menu": tcell.Style{}.Foreground(tcell.ColorBlack).Background(tcell.ColorSilver), + "MenuSelected": tcell.Style{}.Foreground(tcell.ColorSilver).Background(tcell.ColorBlack), + "QuickChar": tcell.Style{}.Foreground(tcell.ColorYellow).Background(tcell.ColorBlack), + "Tab": tcell.Style{}.Foreground(tcell.ColorSilver).Background(tcell.ColorBlack), + "TabContainer": tcell.Style{}.Foreground(tcell.ColorSilver).Background(tcell.ColorBlack), + "TabSelected": tcell.Style{}.Foreground(tcell.ColorBlack).Background(tcell.ColorSilver), + "TextEdit": tcell.Style{}.Foreground(tcell.ColorSilver).Background(tcell.ColorBlack), + "TextEditColumn": tcell.Style{}.Foreground(tcell.ColorBlack).Background(tcell.ColorGray), + "TextEditSelected": tcell.Style{}.Foreground(tcell.ColorBlack).Background(tcell.ColorSilver), + "Window": tcell.Style{}.Foreground(tcell.ColorBlack).Background(tcell.ColorSilver), + "WindowHeader": tcell.Style{}.Foreground(tcell.ColorBlack).Background(tcell.ColorWhite), }