aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/account.go31
-rw-r--r--app/compose.go3
-rw-r--r--app/msglist.go5
3 files changed, 18 insertions, 21 deletions
diff --git a/app/account.go b/app/account.go
index 0f0a58bd..e13da1b6 100644
--- a/app/account.go
+++ b/app/account.go
@@ -35,7 +35,6 @@ type AccountView struct {
worker *types.Worker
state state.AccountState
newConn bool // True if this is a first run after a new connection/reconnection
- uiConf *config.UIConfig
split *MessageViewer
splitSize int
@@ -52,17 +51,14 @@ func (acct *AccountView) UiConfig() *config.UIConfig {
if dirlist := acct.Directories(); dirlist != nil {
return dirlist.UiConfig("")
}
- return acct.uiConf
+ return config.Ui.ForAccount(acct.acct.Name)
}
func NewAccountView(
acct *config.AccountConfig, deferLoop chan struct{},
) (*AccountView, error) {
- acctUiConf := config.Ui.ForAccount(acct.Name)
-
view := &AccountView{
- acct: acct,
- uiConf: acctUiConf,
+ acct: acct,
}
view.grid = ui.NewGrid().Rows([]ui.GridSpec{
@@ -83,8 +79,8 @@ func NewAccountView(
view.worker = worker
view.dirlist = NewDirectoryList(acct, worker)
- if acctUiConf.SidebarWidth > 0 {
- view.grid.AddChild(ui.NewBordered(view.dirlist, ui.BORDER_RIGHT, acctUiConf))
+ if view.UiConfig().SidebarWidth > 0 {
+ view.grid.AddChild(ui.NewBordered(view.dirlist, ui.BORDER_RIGHT, view.UiConfig()))
}
view.msglist = NewMessageList(view)
@@ -593,18 +589,19 @@ func (acct *AccountView) closeSplit() {
{Strategy: ui.SIZE_WEIGHT, Size: ui.Const(1)},
})
- acct.grid.AddChild(ui.NewBordered(acct.dirlist, ui.BORDER_RIGHT, acct.uiConf))
+ acct.grid.AddChild(ui.NewBordered(acct.dirlist, ui.BORDER_RIGHT, acct.UiConfig()))
acct.grid.AddChild(acct.msglist).At(0, 1)
ui.Invalidate()
}
func (acct *AccountView) updateSplitView(msg *models.MessageInfo) {
+ uiConf := acct.UiConfig()
if !acct.splitLoaded {
- switch acct.uiConf.MessageListSplit.Direction {
+ switch uiConf.MessageListSplit.Direction {
case config.SPLIT_HORIZONTAL:
- acct.Split(acct.uiConf.MessageListSplit.Size)
+ acct.Split(uiConf.MessageListSplit.Size)
case config.SPLIT_VERTICAL:
- acct.Vsplit(acct.uiConf.MessageListSplit.Size)
+ acct.Vsplit(uiConf.MessageListSplit.Size)
}
acct.splitLoaded = true
}
@@ -669,8 +666,8 @@ func (acct *AccountView) Split(n int) {
{Strategy: ui.SIZE_WEIGHT, Size: ui.Const(1)},
})
- acct.grid.AddChild(ui.NewBordered(acct.dirlist, ui.BORDER_RIGHT, acct.uiConf)).Span(2, 1)
- acct.grid.AddChild(ui.NewBordered(acct.msglist, ui.BORDER_BOTTOM, acct.uiConf)).At(0, 1)
+ acct.grid.AddChild(ui.NewBordered(acct.dirlist, ui.BORDER_RIGHT, acct.UiConfig())).Span(2, 1)
+ acct.grid.AddChild(ui.NewBordered(acct.msglist, ui.BORDER_BOTTOM, acct.UiConfig())).At(0, 1)
acct.split = NewMessageViewer(acct, nil)
acct.grid.AddChild(acct.split).At(1, 1)
acct.updateSplitView(acct.msglist.Selected())
@@ -694,8 +691,8 @@ func (acct *AccountView) Vsplit(n int) {
{Strategy: ui.SIZE_WEIGHT, Size: ui.Const(1)},
})
- acct.grid.AddChild(ui.NewBordered(acct.dirlist, ui.BORDER_RIGHT, acct.uiConf)).At(0, 0)
- acct.grid.AddChild(ui.NewBordered(acct.msglist, ui.BORDER_RIGHT, acct.uiConf)).At(0, 1)
+ acct.grid.AddChild(ui.NewBordered(acct.dirlist, ui.BORDER_RIGHT, acct.UiConfig())).At(0, 0)
+ acct.grid.AddChild(ui.NewBordered(acct.msglist, ui.BORDER_RIGHT, acct.UiConfig())).At(0, 1)
acct.split = NewMessageViewer(acct, nil)
acct.grid.AddChild(acct.split).At(0, 2)
acct.updateSplitView(acct.msglist.Selected())
@@ -714,7 +711,7 @@ func (acct *AccountView) setTitle() {
data.SetState(&acct.state)
var buf bytes.Buffer
- err := templates.Render(acct.uiConf.TabTitleAccount, &buf, data.Data())
+ err := templates.Render(acct.UiConfig().TabTitleAccount, &buf, data.Data())
if err != nil {
acct.PushError(err)
return
diff --git a/app/compose.go b/app/compose.go
index 7c580032..0f4ada62 100644
--- a/app/compose.go
+++ b/app/compose.go
@@ -1943,7 +1943,8 @@ func (c *Composer) setTitle() {
data.SetHeaders(&header, c.parent)
var buf bytes.Buffer
- err := templates.Render(c.acct.UiConfig().TabTitleComposer, &buf,
+ uiConf := c.acct.UiConfig()
+ err := templates.Render(uiConf.TabTitleComposer, &buf,
data.Data())
if err != nil {
c.acct.PushError(err)
diff --git a/app/msglist.go b/app/msglist.go
index 79e79a1d..9e6f3289 100644
--- a/app/msglist.go
+++ b/app/msglist.go
@@ -31,7 +31,7 @@ type MessageList struct {
func NewMessageList(account *AccountView) *MessageList {
ml := &MessageList{
- spinner: NewSpinner(account.uiConf),
+ spinner: NewSpinner(account.UiConfig()),
isInitalizing: true,
}
// TODO: stop spinner, probably
@@ -88,6 +88,7 @@ func (ml *MessageList) Draw(ctx *ui.Context) {
return
}
+ ml.SetOffset(uiConfig.MsglistScrollOffset)
ml.UpdateScroller(ml.height, len(store.Uids()))
iter := store.UidsIterator()
for i := 0; iter.Next(); i++ {
@@ -357,8 +358,6 @@ func (ml *MessageList) storeUpdate(store *lib.MessageStore) {
func (ml *MessageList) SetStore(store *lib.MessageStore) {
if ml.Store() != store {
ml.Scrollable = Scrollable{}
- n := SelectedAccountUiConfig().MsglistScrollOffset
- ml.SetOffset(n)
}
ml.store = store
if store != nil {