Rename selecter to selector

This commit is contained in:
Kalyan Sriram 2020-07-27 01:03:56 -07:00 committed by Reto Brunner
parent 905cb9dfd3
commit 1023dd9588
3 changed files with 27 additions and 27 deletions

View File

@ -129,12 +129,12 @@ styling.
: The style for the loading spinner. : The style for the loading spinner.
| border | border
: The style used to draw borders. *Only the background color is used*. : The style used to draw borders. *Only the background color is used*.
| selecter_default | selector_default
: The default style for the selecter ui element. : The default style for the selector ui element.
| selecter_focused | selector_focused
: The focused item in a selecter ui element. : The focused item in a selector ui element.
| selecter_chooser | selector_chooser
: The item chooser in a selecter ui element. : The item chooser in a selector ui element.
## fnmatch style wildcard matching ## fnmatch style wildcard matching
The styleset configuration can be made simpler by using the fnmatch The styleset configuration can be made simpler by using the fnmatch

View File

@ -179,7 +179,7 @@ func NewAccountWizard(conf *config.AercConfig, aerc *Aerc) *AccountWizard {
At(7, 0) At(7, 0)
basics.AddChild(wizard.email). basics.AddChild(wizard.email).
At(8, 0) At(8, 0)
selecter := NewSelecter([]string{"Next"}, 0, conf.Ui). selector := NewSelector([]string{"Next"}, 0, conf.Ui).
OnChoose(func(option string) { OnChoose(func(option string) {
email := wizard.email.String() email := wizard.email.String()
if strings.ContainsRune(email, '@') { if strings.ContainsRune(email, '@') {
@ -203,9 +203,9 @@ func NewAccountWizard(conf *config.AercConfig, aerc *Aerc) *AccountWizard {
} }
wizard.advance(option) wizard.advance(option)
}) })
basics.AddChild(selecter).At(9, 0) basics.AddChild(selector).At(9, 0)
wizard.basics = []ui.Interactive{ wizard.basics = []ui.Interactive{
wizard.accountName, wizard.fullName, wizard.email, selecter, wizard.accountName, wizard.fullName, wizard.email, selector,
} }
basics.OnInvalidate(func(_ ui.Drawable) { basics.OnInvalidate(func(_ ui.Drawable) {
wizard.Invalidate() wizard.Invalidate()
@ -261,7 +261,7 @@ func NewAccountWizard(conf *config.AercConfig, aerc *Aerc) *AccountWizard {
ui.NewText("Connection mode", ui.NewText("Connection mode",
conf.Ui.GetStyle(config.STYLE_HEADER))). conf.Ui.GetStyle(config.STYLE_HEADER))).
At(10, 0) At(10, 0)
imapMode := NewSelecter([]string{ imapMode := NewSelector([]string{
"IMAP over SSL/TLS", "IMAP over SSL/TLS",
"IMAP with STARTTLS", "IMAP with STARTTLS",
"Insecure IMAP", "Insecure IMAP",
@ -277,14 +277,14 @@ func NewAccountWizard(conf *config.AercConfig, aerc *Aerc) *AccountWizard {
wizard.imapUri() wizard.imapUri()
}) })
incoming.AddChild(imapMode).At(11, 0) incoming.AddChild(imapMode).At(11, 0)
selecter = NewSelecter([]string{"Previous", "Next"}, 1, conf.Ui). selector = NewSelector([]string{"Previous", "Next"}, 1, conf.Ui).
OnChoose(wizard.advance) OnChoose(wizard.advance)
incoming.AddChild(ui.NewFill(' ')).At(12, 0) incoming.AddChild(ui.NewFill(' ')).At(12, 0)
incoming.AddChild(wizard.imapStr).At(13, 0) incoming.AddChild(wizard.imapStr).At(13, 0)
incoming.AddChild(selecter).At(14, 0) incoming.AddChild(selector).At(14, 0)
wizard.incoming = []ui.Interactive{ wizard.incoming = []ui.Interactive{
wizard.imapUsername, wizard.imapPassword, wizard.imapServer, wizard.imapUsername, wizard.imapPassword, wizard.imapServer,
imapMode, selecter, imapMode, selector,
} }
incoming.OnInvalidate(func(_ ui.Drawable) { incoming.OnInvalidate(func(_ ui.Drawable) {
wizard.Invalidate() wizard.Invalidate()
@ -343,7 +343,7 @@ func NewAccountWizard(conf *config.AercConfig, aerc *Aerc) *AccountWizard {
ui.NewText("Connection mode", ui.NewText("Connection mode",
conf.Ui.GetStyle(config.STYLE_HEADER))). conf.Ui.GetStyle(config.STYLE_HEADER))).
At(10, 0) At(10, 0)
smtpMode := NewSelecter([]string{ smtpMode := NewSelector([]string{
"SMTP over SSL/TLS", "SMTP over SSL/TLS",
"SMTP with STARTTLS", "SMTP with STARTTLS",
"Insecure SMTP", "Insecure SMTP",
@ -359,7 +359,7 @@ func NewAccountWizard(conf *config.AercConfig, aerc *Aerc) *AccountWizard {
wizard.smtpUri() wizard.smtpUri()
}) })
outgoing.AddChild(smtpMode).At(11, 0) outgoing.AddChild(smtpMode).At(11, 0)
selecter = NewSelecter([]string{"Previous", "Next"}, 1, conf.Ui). selector = NewSelector([]string{"Previous", "Next"}, 1, conf.Ui).
OnChoose(wizard.advance) OnChoose(wizard.advance)
outgoing.AddChild(ui.NewFill(' ')).At(12, 0) outgoing.AddChild(ui.NewFill(' ')).At(12, 0)
outgoing.AddChild(wizard.smtpStr).At(13, 0) outgoing.AddChild(wizard.smtpStr).At(13, 0)
@ -367,7 +367,7 @@ func NewAccountWizard(conf *config.AercConfig, aerc *Aerc) *AccountWizard {
outgoing.AddChild( outgoing.AddChild(
ui.NewText("Copy sent messages to 'Sent' folder?", ui.NewText("Copy sent messages to 'Sent' folder?",
conf.Ui.GetStyle(config.STYLE_HEADER))).At(15, 0) conf.Ui.GetStyle(config.STYLE_HEADER))).At(15, 0)
copySent := NewSelecter([]string{"Yes", "No"}, 0, conf.Ui). copySent := NewSelector([]string{"Yes", "No"}, 0, conf.Ui).
Chooser(true).OnChoose(func(option string) { Chooser(true).OnChoose(func(option string) {
switch option { switch option {
case "Yes": case "Yes":
@ -377,10 +377,10 @@ func NewAccountWizard(conf *config.AercConfig, aerc *Aerc) *AccountWizard {
} }
}) })
outgoing.AddChild(copySent).At(16, 0) outgoing.AddChild(copySent).At(16, 0)
outgoing.AddChild(selecter).At(17, 0) outgoing.AddChild(selector).At(17, 0)
wizard.outgoing = []ui.Interactive{ wizard.outgoing = []ui.Interactive{
wizard.smtpUsername, wizard.smtpPassword, wizard.smtpServer, wizard.smtpUsername, wizard.smtpPassword, wizard.smtpServer,
smtpMode, copySent, selecter, smtpMode, copySent, selector,
} }
outgoing.OnInvalidate(func(_ ui.Drawable) { outgoing.OnInvalidate(func(_ ui.Drawable) {
wizard.Invalidate() wizard.Invalidate()
@ -398,7 +398,7 @@ func NewAccountWizard(conf *config.AercConfig, aerc *Aerc) *AccountWizard {
"save your settings to accounts.conf.\n\n"+ "save your settings to accounts.conf.\n\n"+
"To add another account in the future, run ':new-account'.", "To add another account in the future, run ':new-account'.",
conf.Ui.GetStyle(config.STYLE_DEFAULT))) conf.Ui.GetStyle(config.STYLE_DEFAULT)))
selecter = NewSelecter([]string{ selector = NewSelector([]string{
"Previous", "Previous",
"Finish & open tutorial", "Finish & open tutorial",
"Finish", "Finish",
@ -412,8 +412,8 @@ func NewAccountWizard(conf *config.AercConfig, aerc *Aerc) *AccountWizard {
wizard.finish(false) wizard.finish(false)
} }
}) })
complete.AddChild(selecter).At(1, 0) complete.AddChild(selector).At(1, 0)
wizard.complete = []ui.Interactive{selecter} wizard.complete = []ui.Interactive{selector}
complete.OnInvalidate(func(_ ui.Drawable) { complete.OnInvalidate(func(_ ui.Drawable) {
wizard.Invalidate() wizard.Invalidate()
}) })

View File

@ -458,7 +458,7 @@ type PartViewer struct {
sink io.WriteCloser sink io.WriteCloser
source io.Reader source io.Reader
term *Terminal term *Terminal
selecter *Selecter selector *Selector
grid *ui.Grid grid *ui.Grid
uiConfig config.UIConfig uiConfig config.UIConfig
} }
@ -530,7 +530,7 @@ func NewPartViewer(acct *AccountView, conf *config.AercConfig,
{ui.SIZE_WEIGHT, ui.Const(1)}, {ui.SIZE_WEIGHT, ui.Const(1)},
}) })
selecter := NewSelecter([]string{"Save message", "Pipe to command"}, selector := NewSelector([]string{"Save message", "Pipe to command"},
0, acct.UiConfig()). 0, acct.UiConfig()).
OnChoose(func(option string) { OnChoose(func(option string) {
switch option { switch option {
@ -541,7 +541,7 @@ func NewPartViewer(acct *AccountView, conf *config.AercConfig,
} }
}) })
grid.AddChild(selecter).At(2, 0) grid.AddChild(selector).At(2, 0)
pv := &PartViewer{ pv := &PartViewer{
conf: conf, conf: conf,
@ -554,7 +554,7 @@ func NewPartViewer(acct *AccountView, conf *config.AercConfig,
showHeaders: conf.Viewer.ShowHeaders, showHeaders: conf.Viewer.ShowHeaders,
sink: pipe, sink: pipe,
term: term, term: term,
selecter: selecter, selector: selector,
grid: grid, grid: grid,
uiConfig: acct.UiConfig(), uiConfig: acct.UiConfig(),
} }
@ -686,7 +686,7 @@ func (pv *PartViewer) Draw(ctx *ui.Context) {
) )
ctx.Printf(0, 2, style, ctx.Printf(0, 2, style,
"You can still :save the message or :pipe it to an external command") "You can still :save the message or :pipe it to an external command")
pv.selecter.Focus(true) pv.selector.Focus(true)
pv.grid.Draw(ctx) pv.grid.Draw(ctx)
return return
} }
@ -713,7 +713,7 @@ func (pv *PartViewer) Event(event tcell.Event) bool {
if pv.term != nil { if pv.term != nil {
return pv.term.Event(event) return pv.term.Event(event)
} }
return pv.selecter.Event(event) return pv.selector.Event(event)
} }
type HeaderView struct { type HeaderView struct {