Skip to content

Commit 6a97d6d

Browse files
committed
move more stuff to UI thread (image painting)
1 parent 0bacea7 commit 6a97d6d

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

main.go

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import (
1717
"gitlab.com/tslocum/cbind"
1818
)
1919

20-
var VERSION string = "v1.0.4"
20+
var VERSION string = "v1.0.5"
2121

2222
var sndTxt string = ""
2323
var currentReceiver messages.Chat = messages.Chat{}
@@ -60,10 +60,10 @@ func main() {
6060
topBar.SetScrollable(false)
6161
topBar.SetText("[::b] WhatsCLI " + VERSION + " [-::d]Type " + cmdPrefix + "help or press " + config.Config.Keymap.CommandHelp + " for help")
6262
topBar.SetBackgroundColor(tcell.ColorNames[config.Config.Colors.Background])
63-
UpdateStatusBar(messages.SessionStatus{})
6463

6564
infoBar = tview.NewTextView()
6665
infoBar.SetDynamicColors(true)
66+
UpdateStatusBar(messages.SessionStatus{})
6767

6868
textView = tview.NewTextView().
6969
SetDynamicColors(true).
@@ -590,9 +590,7 @@ func UpdateStatusBar(statusInfo messages.SessionStatus) {
590590
}
591591
out += ")[::-] "
592592
out += statusInfo.LastSeen
593-
go app.QueueUpdateDraw(func() {
594-
infoBar.SetText(out)
595-
})
593+
infoBar.SetText(out)
596594
//infoBar.SetText("🔋: ??%")
597595
}
598596

@@ -713,15 +711,19 @@ func (u UiHandler) PrintText(msg string) {
713711
}
714712

715713
func (u UiHandler) PrintFile(path string) {
716-
PrintImage(path)
714+
go app.QueueUpdateDraw(func() {
715+
PrintImage(path)
716+
})
717717
}
718718

719719
func (u UiHandler) OpenFile(path string) {
720720
open.Run(path)
721721
}
722722

723723
func (u UiHandler) SetStatus(status messages.SessionStatus) {
724-
UpdateStatusBar(status)
724+
go app.QueueUpdateDraw(func() {
725+
UpdateStatusBar(status)
726+
})
725727
}
726728

727729
func (u UiHandler) GetWriter() io.Writer {

0 commit comments

Comments
 (0)