Update tab name as subject changes
Also moves truncation to the tab widget
This commit is contained in:
parent
065da5e372
commit
2c486cb7f5
5 changed files with 40 additions and 10 deletions
commands/account
|
@ -3,8 +3,6 @@ package account
|
|||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/mattn/go-runewidth"
|
||||
|
||||
"git.sr.ht/~sircmpwn/aerc2/widgets"
|
||||
)
|
||||
|
||||
|
@ -19,9 +17,15 @@ func Compose(aerc *widgets.Aerc, args []string) error {
|
|||
}
|
||||
acct := aerc.SelectedAccount()
|
||||
composer := widgets.NewComposer(aerc.Config(), acct.AccountConfig())
|
||||
// TODO: Change tab name when message subject changes
|
||||
aerc.NewTab(composer, runewidth.Truncate(
|
||||
"New email", 32, "…"))
|
||||
tab := aerc.NewTab(composer, "New email")
|
||||
composer.OnSubjectChange(func(subject string) {
|
||||
if subject == "" {
|
||||
tab.Name = "New email"
|
||||
} else {
|
||||
tab.Name = subject
|
||||
}
|
||||
tab.Content.Invalidate()
|
||||
})
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
@ -3,8 +3,6 @@ package account
|
|||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/mattn/go-runewidth"
|
||||
|
||||
"git.sr.ht/~sircmpwn/aerc2/widgets"
|
||||
)
|
||||
|
||||
|
@ -26,8 +24,7 @@ func ViewMessage(aerc *widgets.Aerc, args []string) error {
|
|||
return nil
|
||||
}
|
||||
viewer := widgets.NewMessageViewer(aerc.Config(), store, msg)
|
||||
aerc.NewTab(viewer, runewidth.Truncate(
|
||||
msg.Envelope.Subject, 32, "…"))
|
||||
aerc.NewTab(viewer, msg.Envelope.Subject)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue