Skip to content

Commit

Permalink
Fix so the last view doesn't get messed up from the notification panel
Browse files Browse the repository at this point in the history
  • Loading branch information
RasmusLindroth committed Jul 27, 2021
1 parent b0bded5 commit c4373b2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ func main() {
} else {
switch event.Key() {
case tcell.KeyEsc:
if app.UI.StatusView.focus == NotificationPaneFocus {
if app.UI.StatusView.lastList == NotificationPaneFocus {
app.UI.SetFocus(NotificationPaneFocus)
} else {
app.UI.SetFocus(LeftPaneFocus)
Expand Down
18 changes: 15 additions & 3 deletions statusview.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,6 @@ type StatusView struct {

func (t *StatusView) AddFeed(f Feed) {
t.feeds = append(t.feeds, f)
t.focus = LeftPaneFocus
t.lastList = LeftPaneFocus
f.DrawList()
t.list.SetCurrentItem(f.GetSavedIndex())
f.DrawToot()
Expand All @@ -94,6 +92,8 @@ func (t *StatusView) AddFeed(f Feed) {
if t.lastList == NotificationPaneFocus {
t.app.UI.SetFocus(LeftPaneFocus)
t.focus = LeftPaneFocus
t.lastList = NotificationPaneFocus
} else {
t.lastList = LeftPaneFocus
}
}
Expand All @@ -103,8 +103,20 @@ func (t *StatusView) RemoveLatestFeed() {
feed := t.feeds[len(t.feeds)-1]
feed.DrawList()
t.list.SetCurrentItem(feed.GetSavedIndex())
feed.DrawToot()

if t.lastList == NotificationPaneFocus {
t.app.UI.SetFocus(NotificationPaneFocus)
t.focus = NotificationPaneFocus
t.lastList = NotificationPaneFocus
t.notificationView.feed.DrawToot()
} else {
t.app.UI.SetFocus(LeftPaneFocus)
t.focus = LeftPaneFocus
t.lastList = LeftPaneFocus
feed.DrawToot()
}
t.drawDesc()

}

func (t *StatusView) GetLeftView() tview.Primitive {
Expand Down

0 comments on commit c4373b2

Please sign in to comment.