view,compose: use border color to separate headers from body
When composing a message, there is an empty fill line between the headers and the text editor. The line is printed with the default style which may cause users to assume it is part of the editor. Display the fill lines with the border color to avoid confusion. Signed-off-by: Robin Jarry <robin@jarry.cc>
This commit is contained in:
parent
42b4302ba3
commit
fc84b19bba
|
@ -4,16 +4,19 @@ import (
|
|||
"github.com/gdamore/tcell/v2"
|
||||
)
|
||||
|
||||
type Fill rune
|
||||
type Fill struct {
|
||||
Rune rune
|
||||
Style tcell.Style
|
||||
}
|
||||
|
||||
func NewFill(f rune) Fill {
|
||||
return Fill(f)
|
||||
func NewFill(f rune, s tcell.Style) Fill {
|
||||
return Fill{f, s}
|
||||
}
|
||||
|
||||
func (f Fill) Draw(ctx *Context) {
|
||||
for x := 0; x < ctx.Width(); x += 1 {
|
||||
for y := 0; y < ctx.Height(); y += 1 {
|
||||
ctx.SetCell(x, y, rune(f), tcell.StyleDefault)
|
||||
ctx.SetCell(x, y, f.Rune, f.Style)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -163,7 +163,7 @@ func NewAccountWizard(conf *config.AercConfig, aerc *Aerc) *AccountWizard {
|
|||
At(1, 0)
|
||||
basics.AddChild(wizard.accountName).
|
||||
At(2, 0)
|
||||
basics.AddChild(ui.NewFill(' ')).
|
||||
basics.AddChild(ui.NewFill(' ', tcell.StyleDefault)).
|
||||
At(3, 0)
|
||||
basics.AddChild(
|
||||
ui.NewText("Full name for outgoing emails? (e.g. 'John Doe')",
|
||||
|
@ -171,7 +171,7 @@ func NewAccountWizard(conf *config.AercConfig, aerc *Aerc) *AccountWizard {
|
|||
At(4, 0)
|
||||
basics.AddChild(wizard.fullName).
|
||||
At(5, 0)
|
||||
basics.AddChild(ui.NewFill(' ')).
|
||||
basics.AddChild(ui.NewFill(' ', tcell.StyleDefault)).
|
||||
At(6, 0)
|
||||
basics.AddChild(
|
||||
ui.NewText("Your email address? (e.g. 'john@example.org')",
|
||||
|
@ -238,7 +238,7 @@ func NewAccountWizard(conf *config.AercConfig, aerc *Aerc) *AccountWizard {
|
|||
At(1, 0)
|
||||
incoming.AddChild(wizard.imapUsername).
|
||||
At(2, 0)
|
||||
incoming.AddChild(ui.NewFill(' ')).
|
||||
incoming.AddChild(ui.NewFill(' ', tcell.StyleDefault)).
|
||||
At(3, 0)
|
||||
incoming.AddChild(
|
||||
ui.NewText("Password",
|
||||
|
@ -246,7 +246,7 @@ func NewAccountWizard(conf *config.AercConfig, aerc *Aerc) *AccountWizard {
|
|||
At(4, 0)
|
||||
incoming.AddChild(wizard.imapPassword).
|
||||
At(5, 0)
|
||||
incoming.AddChild(ui.NewFill(' ')).
|
||||
incoming.AddChild(ui.NewFill(' ', tcell.StyleDefault)).
|
||||
At(6, 0)
|
||||
incoming.AddChild(
|
||||
ui.NewText("Server address "+
|
||||
|
@ -255,7 +255,7 @@ func NewAccountWizard(conf *config.AercConfig, aerc *Aerc) *AccountWizard {
|
|||
At(7, 0)
|
||||
incoming.AddChild(wizard.imapServer).
|
||||
At(8, 0)
|
||||
incoming.AddChild(ui.NewFill(' ')).
|
||||
incoming.AddChild(ui.NewFill(' ', tcell.StyleDefault)).
|
||||
At(9, 0)
|
||||
incoming.AddChild(
|
||||
ui.NewText("Connection mode",
|
||||
|
@ -279,7 +279,7 @@ func NewAccountWizard(conf *config.AercConfig, aerc *Aerc) *AccountWizard {
|
|||
incoming.AddChild(imapMode).At(11, 0)
|
||||
selector = NewSelector([]string{"Previous", "Next"}, 1, conf.Ui).
|
||||
OnChoose(wizard.advance)
|
||||
incoming.AddChild(ui.NewFill(' ')).At(12, 0)
|
||||
incoming.AddChild(ui.NewFill(' ', tcell.StyleDefault)).At(12, 0)
|
||||
incoming.AddChild(wizard.imapStr).At(13, 0)
|
||||
incoming.AddChild(selector).At(14, 0)
|
||||
wizard.incoming = []ui.Interactive{
|
||||
|
@ -320,7 +320,7 @@ func NewAccountWizard(conf *config.AercConfig, aerc *Aerc) *AccountWizard {
|
|||
At(1, 0)
|
||||
outgoing.AddChild(wizard.smtpUsername).
|
||||
At(2, 0)
|
||||
outgoing.AddChild(ui.NewFill(' ')).
|
||||
outgoing.AddChild(ui.NewFill(' ', tcell.StyleDefault)).
|
||||
At(3, 0)
|
||||
outgoing.AddChild(
|
||||
ui.NewText("Password",
|
||||
|
@ -328,7 +328,7 @@ func NewAccountWizard(conf *config.AercConfig, aerc *Aerc) *AccountWizard {
|
|||
At(4, 0)
|
||||
outgoing.AddChild(wizard.smtpPassword).
|
||||
At(5, 0)
|
||||
outgoing.AddChild(ui.NewFill(' ')).
|
||||
outgoing.AddChild(ui.NewFill(' ', tcell.StyleDefault)).
|
||||
At(6, 0)
|
||||
outgoing.AddChild(
|
||||
ui.NewText("Server address "+
|
||||
|
@ -337,7 +337,7 @@ func NewAccountWizard(conf *config.AercConfig, aerc *Aerc) *AccountWizard {
|
|||
At(7, 0)
|
||||
outgoing.AddChild(wizard.smtpServer).
|
||||
At(8, 0)
|
||||
outgoing.AddChild(ui.NewFill(' ')).
|
||||
outgoing.AddChild(ui.NewFill(' ', tcell.StyleDefault)).
|
||||
At(9, 0)
|
||||
outgoing.AddChild(
|
||||
ui.NewText("Connection mode",
|
||||
|
@ -361,9 +361,9 @@ func NewAccountWizard(conf *config.AercConfig, aerc *Aerc) *AccountWizard {
|
|||
outgoing.AddChild(smtpMode).At(11, 0)
|
||||
selector = NewSelector([]string{"Previous", "Next"}, 1, conf.Ui).
|
||||
OnChoose(wizard.advance)
|
||||
outgoing.AddChild(ui.NewFill(' ')).At(12, 0)
|
||||
outgoing.AddChild(ui.NewFill(' ', tcell.StyleDefault)).At(12, 0)
|
||||
outgoing.AddChild(wizard.smtpStr).At(13, 0)
|
||||
outgoing.AddChild(ui.NewFill(' ')).At(14, 0)
|
||||
outgoing.AddChild(ui.NewFill(' ', tcell.StyleDefault)).At(14, 0)
|
||||
outgoing.AddChild(
|
||||
ui.NewText("Copy sent messages to 'Sent' folder?",
|
||||
conf.Ui.GetStyle(config.STYLE_HEADER))).At(15, 0)
|
||||
|
|
|
@ -230,8 +230,8 @@ func (aerc *Aerc) Event(event tcell.Event) bool {
|
|||
aerc.statusline.Expire()
|
||||
aerc.pendingKeys = append(aerc.pendingKeys, config.KeyStroke{
|
||||
Modifiers: event.Modifiers(),
|
||||
Key: event.Key(),
|
||||
Rune: event.Rune(),
|
||||
Key: event.Key(),
|
||||
Rune: event.Rune(),
|
||||
})
|
||||
aerc.statusline.Invalidate()
|
||||
bindings := aerc.getBindings()
|
||||
|
@ -648,8 +648,8 @@ func errorScreen(s string, conf config.UIConfig) ui.Drawable {
|
|||
}).Columns([]ui.GridSpec{
|
||||
{ui.SIZE_WEIGHT, ui.Const(1)},
|
||||
})
|
||||
grid.AddChild(ui.NewFill(' ')).At(0, 0)
|
||||
grid.AddChild(ui.NewFill(' ', tcell.StyleDefault)).At(0, 0)
|
||||
grid.AddChild(text).At(1, 0)
|
||||
grid.AddChild(ui.NewFill(' ')).At(2, 0)
|
||||
grid.AddChild(ui.NewFill(' ', tcell.StyleDefault)).At(2, 0)
|
||||
return grid
|
||||
}
|
||||
|
|
|
@ -678,9 +678,10 @@ func (c *Composer) updateGrid() {
|
|||
if c.heditors != nil {
|
||||
c.grid.RemoveChild(c.heditors)
|
||||
}
|
||||
borderStyle := c.config.Ui.GetStyle(config.STYLE_BORDER)
|
||||
c.heditors = heditors
|
||||
c.grid.AddChild(c.heditors).At(0, 0)
|
||||
c.grid.AddChild(ui.NewFill(' ')).At(1, 0)
|
||||
c.grid.AddChild(ui.NewFill(' ', borderStyle)).At(1, 0)
|
||||
}
|
||||
|
||||
func (c *Composer) reloadEmail() error {
|
||||
|
|
|
@ -105,13 +105,15 @@ func NewMessageViewer(acct *AccountView,
|
|||
}
|
||||
}
|
||||
|
||||
borderStyle := acct.UiConfig().GetStyle(config.STYLE_BORDER)
|
||||
|
||||
grid.AddChild(header).At(0, 0)
|
||||
if msg.PGPDetails() != nil {
|
||||
grid.AddChild(NewPGPInfo(msg.PGPDetails(), acct.UiConfig())).At(1, 0)
|
||||
grid.AddChild(ui.NewFill(' ')).At(2, 0)
|
||||
grid.AddChild(ui.NewFill(' ', borderStyle)).At(2, 0)
|
||||
grid.AddChild(switcher).At(3, 0)
|
||||
} else {
|
||||
grid.AddChild(ui.NewFill(' ')).At(1, 0)
|
||||
grid.AddChild(ui.NewFill(' ', borderStyle)).At(1, 0)
|
||||
grid.AddChild(switcher).At(2, 0)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue