aboutsummaryrefslogtreecommitdiffstats
path: root/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'widgets')
-rw-r--r--widgets/account-wizard.go2
-rw-r--r--widgets/aerc.go3
-rw-r--r--widgets/compose.go31
-rw-r--r--widgets/dirlist.go1
-rw-r--r--widgets/dirtree.go2
-rw-r--r--widgets/exline.go8
-rw-r--r--widgets/getpasswd.go3
-rw-r--r--widgets/msglist.go2
-rw-r--r--widgets/msgviewer.go18
-rw-r--r--widgets/scrollable.go1
-rw-r--r--widgets/selector.go3
-rw-r--r--widgets/terminal.go8
12 files changed, 40 insertions, 42 deletions
diff --git a/widgets/account-wizard.go b/widgets/account-wizard.go
index 8b78dcdb..57032884 100644
--- a/widgets/account-wizard.go
+++ b/widgets/account-wizard.go
@@ -506,7 +506,7 @@ func (wizard *AccountWizard) finish(tutorial bool) {
}
if !wizard.temporary {
- f, err := os.OpenFile(accountsConf, os.O_WRONLY|os.O_CREATE, 0600)
+ f, err := os.OpenFile(accountsConf, os.O_WRONLY|os.O_CREATE, 0o600)
if err != nil {
wizard.errorFor(nil, err)
return
diff --git a/widgets/aerc.go b/widgets/aerc.go
index 68144aa0..90e7a9e5 100644
--- a/widgets/aerc.go
+++ b/widgets/aerc.go
@@ -51,7 +51,8 @@ type Choice struct {
func NewAerc(conf *config.AercConfig,
crypto crypto.Provider, cmd func(cmd []string) error,
complete func(cmd string) []string, cmdHistory lib.History,
- deferLoop chan struct{}) *Aerc {
+ deferLoop chan struct{},
+) *Aerc {
tabs := ui.NewTabs(&conf.Ui)
statusbar := ui.NewStack(conf.Ui)
diff --git a/widgets/compose.go b/widgets/compose.go
index a4ed27ce..b9528e0e 100644
--- a/widgets/compose.go
+++ b/widgets/compose.go
@@ -65,8 +65,8 @@ type Composer struct {
func NewComposer(aerc *Aerc, acct *AccountView, conf *config.AercConfig,
acctConfig *config.AccountConfig, worker *types.Worker, template string,
- h *mail.Header, orig models.OriginalMail) (*Composer, error) {
-
+ h *mail.Header, orig models.OriginalMail,
+) (*Composer, error) {
if h == nil {
h = new(mail.Header)
}
@@ -78,7 +78,6 @@ func NewComposer(aerc *Aerc, acct *AccountView, conf *config.AercConfig,
}
if fl != nil {
h.SetAddressList("from", fl)
-
}
}
@@ -134,7 +133,6 @@ func NewComposer(aerc *Aerc, acct *AccountView, conf *config.AercConfig,
}
func (c *Composer) buildComposeHeader(aerc *Aerc, cmpl *completer.Completer) {
-
c.layout = aerc.conf.Compose.HeaderLayout
c.editors = make(map[string]*headerEditor)
c.focusable = make([]ui.MouseableDrawableInteractive, 0)
@@ -540,7 +538,7 @@ func (c *Composer) Worker() *types.Worker {
return c.worker
}
-//PrepareHeader finalizes the header, adding the value from the editors
+// PrepareHeader finalizes the header, adding the value from the editors
func (c *Composer) PrepareHeader() (*mail.Header, error) {
for _, editor := range c.editors {
editor.storeValue()
@@ -594,7 +592,7 @@ func getRecipientsEmail(c *Composer) ([]string, error) {
// return email addresses as string slice
results := []string{}
- for email, _ := range rcpts {
+ for email := range rcpts {
results = append(results, email)
}
return results, nil
@@ -933,7 +931,8 @@ type headerEditor struct {
}
func newHeaderEditor(name string, h *mail.Header,
- uiConfig *config.UIConfig) *headerEditor {
+ uiConfig *config.UIConfig,
+) *headerEditor {
he := &headerEditor{
input: ui.NewTextInput("", uiConfig),
name: name,
@@ -944,8 +943,8 @@ func newHeaderEditor(name string, h *mail.Header,
return he
}
-//extractHumanHeaderValue extracts the human readable string for key from the
-//header. If a parsing error occurs the raw value is returned
+// extractHumanHeaderValue extracts the human readable string for key from the
+// header. If a parsing error occurs the raw value is returned
func extractHumanHeaderValue(key string, h *mail.Header) string {
var val string
var err error
@@ -964,16 +963,16 @@ func extractHumanHeaderValue(key string, h *mail.Header) string {
return val
}
-//loadValue loads the value of he.name form the underlying header
-//the value is decoded and meant for human consumption.
-//decoding issues are ignored and return their raw values
+// loadValue loads the value of he.name form the underlying header
+// the value is decoded and meant for human consumption.
+// decoding issues are ignored and return their raw values
func (he *headerEditor) loadValue() {
he.input.Set(extractHumanHeaderValue(he.name, he.header))
he.input.Invalidate()
}
-//storeValue writes the current state back to the underlying header.
-//errors are ignored
+// storeValue writes the current state back to the underlying header.
+// errors are ignored
func (he *headerEditor) storeValue() {
val := he.input.String()
switch strings.ToLower(he.name) {
@@ -996,8 +995,8 @@ func (he *headerEditor) storeValue() {
}
}
-//setValue overwrites the current value of the header editor and flushes it
-//to the underlying header
+// setValue overwrites the current value of the header editor and flushes it
+// to the underlying header
func (he *headerEditor) setValue(val string) {
he.input.Set(val)
he.storeValue()
diff --git a/widgets/dirlist.go b/widgets/dirlist.go
index 2047c304..984fc01c 100644
--- a/widgets/dirlist.go
+++ b/widgets/dirlist.go
@@ -119,7 +119,6 @@ func (dirlist *DirectoryList) UpdateList(done func(dirs []string)) {
var dirs []string
dirlist.worker.PostAction(
&types.ListDirectories{}, func(msg types.WorkerMessage) {
-
switch msg := msg.(type) {
case *types.Directory:
dirs = append(dirs, msg.Dir.Name)
diff --git a/widgets/dirtree.go b/widgets/dirtree.go
index 1130329a..1b7e2e1f 100644
--- a/widgets/dirtree.go
+++ b/widgets/dirtree.go
@@ -383,7 +383,7 @@ func buildTree(node *types.Thread, stree [][]string, defaultUid uint32) {
}
}
keys := make([]string, 0)
- for key, _ := range m {
+ for key := range m {
keys = append(keys, key)
}
sort.Strings(keys)
diff --git a/widgets/exline.go b/widgets/exline.go
index 4a4b6559..e172dd81 100644
--- a/widgets/exline.go
+++ b/widgets/exline.go
@@ -20,8 +20,8 @@ type ExLine struct {
func NewExLine(conf *config.AercConfig, cmd string, commit func(cmd string), finish func(),
tabcomplete func(cmd string) ([]string, string),
- cmdHistory lib.History) *ExLine {
-
+ cmdHistory lib.History,
+) *ExLine {
input := ui.NewTextInput("", &conf.Ui).Prompt(":").Set(cmd)
if conf.Ui.CompletionPopovers {
input.TabComplete(tabcomplete, conf.Ui.CompletionDelay)
@@ -41,8 +41,8 @@ func NewExLine(conf *config.AercConfig, cmd string, commit func(cmd string), fin
}
func NewPrompt(conf *config.AercConfig, prompt string, commit func(text string),
- tabcomplete func(cmd string) ([]string, string)) *ExLine {
-
+ tabcomplete func(cmd string) ([]string, string),
+) *ExLine {
input := ui.NewTextInput("", &conf.Ui).Prompt(prompt)
if conf.Ui.CompletionPopovers {
input.TabComplete(tabcomplete, conf.Ui.CompletionDelay)
diff --git a/widgets/getpasswd.go b/widgets/getpasswd.go
index e4cf07b4..e6de75e1 100644
--- a/widgets/getpasswd.go
+++ b/widgets/getpasswd.go
@@ -19,7 +19,8 @@ type GetPasswd struct {
}
func NewGetPasswd(title string, prompt string, conf *config.AercConfig,
- cb func(string, error)) *GetPasswd {
+ cb func(string, error),
+) *GetPasswd {
getpasswd := &GetPasswd{
callback: cb,
title: title,
diff --git a/widgets/msglist.go b/widgets/msglist.go
index 23eb4102..1ddf46dc 100644
--- a/widgets/msglist.go
+++ b/widgets/msglist.go
@@ -102,7 +102,7 @@ func (ml *MessageList) Draw(ctx *ui.Context) {
}
counter--
if counter > len(store.Uids())-1-ml.Scroll() {
- //skip messages which are higher than the viewport
+ // skip messages which are higher than the viewport
return nil
}
msg := store.Messages[t.Uid]
diff --git a/widgets/msgviewer.go b/widgets/msgviewer.go
index eec786c5..be578b93 100644
--- a/widgets/msgviewer.go
+++ b/widgets/msgviewer.go
@@ -52,8 +52,8 @@ type PartSwitcher struct {
}
func NewMessageViewer(acct *AccountView,
- conf *config.AercConfig, msg lib.MessageView) *MessageViewer {
-
+ conf *config.AercConfig, msg lib.MessageView,
+) *MessageViewer {
hf := HeaderLayoutFilter{
layout: HeaderLayout(conf.Viewer.HeaderLayout),
keep: func(msg *models.MessageInfo, header string) bool {
@@ -178,8 +178,8 @@ func fmtHeader(msg *models.MessageInfo, header string, timefmt string) string {
func enumerateParts(acct *AccountView, conf *config.AercConfig,
msg lib.MessageView, body *models.BodyStructure,
- index []int) ([]*PartViewer, error) {
-
+ index []int,
+) ([]*PartViewer, error) {
var parts []*PartViewer
for i, part := range body.Parts {
curindex := append(index, i+1)
@@ -205,8 +205,8 @@ func enumerateParts(acct *AccountView, conf *config.AercConfig,
}
func createSwitcher(acct *AccountView, switcher *PartSwitcher,
- conf *config.AercConfig, msg lib.MessageView) error {
-
+ conf *config.AercConfig, msg lib.MessageView,
+) error {
var err error
switcher.selected = -1
switcher.showHeaders = conf.Viewer.ShowHeaders
@@ -530,8 +530,8 @@ type PartViewer struct {
func NewPartViewer(acct *AccountView, conf *config.AercConfig,
msg lib.MessageView, part *models.BodyStructure,
- index []int) (*PartViewer, error) {
-
+ index []int,
+) (*PartViewer, error) {
var (
filter *exec.Cmd
pager *exec.Cmd
@@ -634,7 +634,7 @@ func (pv *PartViewer) attemptCopy() {
return
}
if pv.filter != nil {
- pv.copyFilterOutToPager() //delayed until we write to the sink
+ pv.copyFilterOutToPager() // delayed until we write to the sink
}
go func() {
defer logging.PanicHandler()
diff --git a/widgets/scrollable.go b/widgets/scrollable.go
index 0e8bb5a8..f478f858 100644
--- a/widgets/scrollable.go
+++ b/widgets/scrollable.go
@@ -64,5 +64,4 @@ func (s *Scrollable) EnsureScroll(selectingIdx int) {
if s.scroll > maxScroll {
s.scroll = maxScroll
}
-
}
diff --git a/widgets/selector.go b/widgets/selector.go
index ea1dd97a..71224c9b 100644
--- a/widgets/selector.go
+++ b/widgets/selector.go
@@ -176,7 +176,8 @@ type SelectorDialog struct {
}
func NewSelectorDialog(title string, prompt string, options []string, focus int,
- uiConfig *config.UIConfig, cb func(string, error)) *SelectorDialog {
+ uiConfig *config.UIConfig, cb func(string, error),
+) *SelectorDialog {
sd := &SelectorDialog{
callback: cb,
title: title,
diff --git a/widgets/terminal.go b/widgets/terminal.go
index e499e3e4..962b02e8 100644
--- a/widgets/terminal.go
+++ b/widgets/terminal.go
@@ -82,8 +82,7 @@ func init() {
keyMap[tcell.KeyPgUp] = directKey(vterm.KeyPageUp)
keyMap[tcell.KeyPgDn] = directKey(vterm.KeyPageDown)
for i := 0; i < 64; i++ {
- keyMap[tcell.Key(int(tcell.KeyF1)+i)] =
- directKey(vterm.Key(int(vterm.KeyFunction0) + i + 1))
+ keyMap[tcell.Key(int(tcell.KeyF1)+i)] = directKey(vterm.Key(int(vterm.KeyFunction0) + i + 1))
}
keyMap[tcell.KeyTAB] = directKey(vterm.KeyTab)
keyMap[tcell.KeyESC] = directKey(vterm.KeyEscape)
@@ -302,7 +301,6 @@ func (term *Terminal) Draw(ctx *ui.Context) {
term.damageMutex.Lock()
for _, rect := range term.damage {
for x := rect.StartCol(); x < rect.EndCol() && x < ctx.Width(); x += 1 {
-
for y := rect.StartRow(); y < rect.EndRow() && y < ctx.Height(); y += 1 {
coords := coords{x, y}
@@ -472,8 +470,8 @@ func (term *Terminal) onDamage(rect *vterm.Rect) int {
}
func (term *Terminal) onMoveCursor(old *vterm.Pos,
- pos *vterm.Pos, visible bool) int {
-
+ pos *vterm.Pos, visible bool,
+) int {
rows, cols, _ := pty.Getsize(term.pty)
if pos.Row() >= rows || pos.Col() >= cols {
return 1