diff options
author | Reto Brunner <reto@labrat.space> | 2020-07-30 23:22:32 +0200 |
---|---|---|
committer | Reto Brunner <reto@labrat.space> | 2020-07-30 23:22:32 +0200 |
commit | 3d784c5d8c7d037e38159fc1753773a2e81aa43e (patch) | |
tree | 2c062c9f4b4641a59e3f4f3ff3317f636bfd49cf /lib/ui/textinput.go | |
parent | 6ee7b1c3fd40b0e2f93dcaa7ffb3b0bdd56ac285 (diff) | |
download | aerc-3d784c5d8c7d037e38159fc1753773a2e81aa43e.tar.gz |
Revert "Implement style configuration."
This reverts commit 1ff687ca2b0821c2cacc1fa725abb3302d2af9da.
Diffstat (limited to 'lib/ui/textinput.go')
-rw-r--r-- | lib/ui/textinput.go | 32 |
1 files changed, 12 insertions, 20 deletions
diff --git a/lib/ui/textinput.go b/lib/ui/textinput.go index 24450658..f6b0c725 100644 --- a/lib/ui/textinput.go +++ b/lib/ui/textinput.go @@ -6,8 +6,6 @@ import ( "github.com/gdamore/tcell" "github.com/mattn/go-runewidth" - - "git.sr.ht/~sircmpwn/aerc/config" ) // TODO: Attach history providers @@ -29,18 +27,16 @@ type TextInput struct { completeIndex int completeDelay time.Duration completeDebouncer *time.Timer - uiConfig config.UIConfig } // Creates a new TextInput. TextInputs will render a "textbox" in the entire // context they're given, and process keypresses to build a string from user // input. -func NewTextInput(text string, ui config.UIConfig) *TextInput { +func NewTextInput(text string) *TextInput { return &TextInput{ - cells: -1, - text: []rune(text), - index: len([]rune(text)), - uiConfig: ui, + cells: -1, + text: []rune(text), + index: len([]rune(text)), } } @@ -91,18 +87,16 @@ func (ti *TextInput) Draw(ctx *Context) { ti.ensureScroll() } ti.ctx = ctx // gross - - defaultStyle := ti.uiConfig.GetStyle(config.STYLE_DEFAULT) - ctx.Fill(0, 0, ctx.Width(), ctx.Height(), ' ', defaultStyle) + ctx.Fill(0, 0, ctx.Width(), ctx.Height(), ' ', tcell.StyleDefault) text := ti.text[scroll:] sindex := ti.index - scroll if ti.password { - x := ctx.Printf(0, 0, defaultStyle, "%s", ti.prompt) + x := ctx.Printf(0, 0, tcell.StyleDefault, "%s", ti.prompt) cells := runewidth.StringWidth(string(text)) - ctx.Fill(x, 0, cells, 1, '*', defaultStyle) + ctx.Fill(x, 0, cells, 1, '*', tcell.StyleDefault) } else { - ctx.Printf(0, 0, defaultStyle, "%s%s", ti.prompt, string(text)) + ctx.Printf(0, 0, tcell.StyleDefault, "%s%s", ti.prompt, string(text)) } cells := runewidth.StringWidth(string(text[:sindex]) + ti.prompt) if ti.focus { @@ -132,7 +126,6 @@ func (ti *TextInput) drawPopover(ctx *Context) { ti.Set(stem + ti.StringRight()) ti.Invalidate() }, - uiConfig: ti.uiConfig, } width := maxLen(ti.completions) + 3 height := len(ti.completions) @@ -360,7 +353,6 @@ type completions struct { onSelect func(int) onExec func() onStem func(string) - uiConfig config.UIConfig } func maxLen(ss []string) int { @@ -375,10 +367,10 @@ func maxLen(ss []string) int { } func (c *completions) Draw(ctx *Context) { - bg := c.uiConfig.GetStyle(config.STYLE_COMPLETION_DEFAULT) - gutter := c.uiConfig.GetStyle(config.STYLE_COMPLETION_GUTTER) - pill := c.uiConfig.GetStyle(config.STYLE_COMPLETION_PILL) - sel := c.uiConfig.GetStyleSelected(config.STYLE_COMPLETION_DEFAULT) + bg := tcell.StyleDefault + sel := tcell.StyleDefault.Reverse(true) + gutter := tcell.StyleDefault + pill := tcell.StyleDefault.Reverse(true) ctx.Fill(0, 0, ctx.Width(), ctx.Height(), ' ', bg) |