diff --git a/app/wtf_app.go b/app/wtf_app.go index 6d1f1cb94..776fe7eb2 100644 --- a/app/wtf_app.go +++ b/app/wtf_app.go @@ -107,6 +107,7 @@ func (wtfApp *WtfApp) stopAllWidgets() { func (wtfApp *WtfApp) keyboardIntercept(event *tcell.EventKey) *tcell.EventKey { // These keys are global keys used by the app. Widgets should not implement these keys + switch event.Key() { case tcell.KeyCtrlC: wtfApp.Stop() diff --git a/modules/bargraph/widget.go b/modules/bargraph/widget.go index 3d57f1c0e..ee81cfe2d 100644 --- a/modules/bargraph/widget.go +++ b/modules/bargraph/widget.go @@ -68,15 +68,5 @@ func (widget *Widget) Refresh() { } widget.View.Clear() - - widget.tviewApp.QueueUpdateDraw(func() { - display(widget) - }) - -} - -/* -------------------- Unexported Functions -------------------- */ - -func display(widget *Widget) { MakeGraph(widget) } diff --git a/modules/git/widget.go b/modules/git/widget.go index 9697d3559..b79fc45db 100644 --- a/modules/git/widget.go +++ b/modules/git/widget.go @@ -102,11 +102,9 @@ func (widget *Widget) addCancelButton(form *tview.Form) { } func (widget *Widget) modalFocus(form *tview.Form) { - widget.tviewApp.QueueUpdateDraw(func() { - frame := widget.modalFrame(form) - widget.pages.AddPage("modal", frame, false, true) - widget.tviewApp.SetFocus(frame) - }) + frame := widget.modalFrame(form) + widget.pages.AddPage("modal", frame, false, true) + widget.tviewApp.SetFocus(frame) } func (widget *Widget) modalForm(lbl, text string) *tview.Form { diff --git a/modules/mercurial/widget.go b/modules/mercurial/widget.go index b214ccc17..7c996aebf 100644 --- a/modules/mercurial/widget.go +++ b/modules/mercurial/widget.go @@ -100,11 +100,9 @@ func (widget *Widget) addCancelButton(form *tview.Form) { } func (widget *Widget) modalFocus(form *tview.Form) { - widget.tviewApp.QueueUpdateDraw(func() { - frame := widget.modalFrame(form) - widget.pages.AddPage("modal", frame, false, true) - widget.tviewApp.SetFocus(frame) - }) + frame := widget.modalFrame(form) + widget.pages.AddPage("modal", frame, false, true) + widget.tviewApp.SetFocus(frame) } func (widget *Widget) modalForm(lbl, text string) *tview.Form { diff --git a/modules/resourceusage/widget.go b/modules/resourceusage/widget.go index 23d9fdf94..1536a1d56 100644 --- a/modules/resourceusage/widget.go +++ b/modules/resourceusage/widget.go @@ -130,18 +130,12 @@ func (widget *Widget) Refresh() { return } - widget.tviewApp.QueueUpdateDraw(func() { - widget.View.Clear() - display(widget) - }) + widget.View.Clear() + MakeGraph(widget) } /* -------------------- Unexported Functions -------------------- */ -func display(widget *Widget) { - MakeGraph(widget) -} - func getDataFromSystem(widget *Widget) (cpuStats []float64, memInfo mem.VirtualMemoryStat) { if widget.settings.showCPU { rCPUStats, err := cpu.Percent(time.Duration(0), !widget.settings.cpuCombined) diff --git a/modules/todo/widget.go b/modules/todo/widget.go index 8663b3c90..a5e051c8c 100644 --- a/modules/todo/widget.go +++ b/modules/todo/widget.go @@ -308,10 +308,6 @@ func (widget *Widget) processFormInput(prompt string, initValue string, onSave f widget.addButtons(form, saveFctn) widget.modalFocus(form) - - widget.tviewApp.QueueUpdate(func() { - widget.tviewApp.Draw() - }) } // updateSelectedItem update the text of the selected item. @@ -377,11 +373,9 @@ func (widget *Widget) addSaveButton(form *tview.Form, fctn func()) { } func (widget *Widget) modalFocus(form *tview.Form) { - widget.tviewApp.QueueUpdateDraw(func() { - frame := widget.modalFrame(form) - widget.pages.AddPage("modal", frame, false, true) - widget.tviewApp.SetFocus(frame) - }) + frame := widget.modalFrame(form) + widget.pages.AddPage("modal", frame, false, true) + widget.tviewApp.SetFocus(frame) } func (widget *Widget) modalForm(lbl, text string) *tview.Form { diff --git a/view/scrollable_widget.go b/view/scrollable_widget.go index 1d74af72d..41714bb30 100644 --- a/view/scrollable_widget.go +++ b/view/scrollable_widget.go @@ -84,8 +84,6 @@ func (widget *ScrollableWidget) Unselect() { func (widget *ScrollableWidget) Redraw(data func() (string, string, bool)) { widget.TextWidget.Redraw(data) - widget.tviewApp.QueueUpdateDraw(func() { - widget.View.Highlight(strconv.Itoa(widget.Selected)) - widget.View.ScrollToHighlight() - }) + widget.View.Highlight(strconv.Itoa(widget.Selected)) + widget.View.ScrollToHighlight() } diff --git a/view/text_widget.go b/view/text_widget.go index 1cfa32ebe..305608e16 100644 --- a/view/text_widget.go +++ b/view/text_widget.go @@ -45,14 +45,12 @@ func (widget *TextWidget) TextView() *tview.TextView { // Redraw forces a refresh of the onscreen text content of this widget func (widget *TextWidget) Redraw(data func() (string, string, bool)) { - widget.tviewApp.QueueUpdateDraw(func() { - title, content, wrap := data() - - widget.View.Clear() - widget.View.SetWrap(wrap) - widget.View.SetTitle(widget.ContextualTitle(title)) - widget.View.SetText(strings.TrimRight(content, "\n")) - }) + title, content, wrap := data() + + widget.View.Clear() + widget.View.SetWrap(wrap) + widget.View.SetTitle(widget.ContextualTitle(title)) + widget.View.SetText(strings.TrimRight(content, "\n")) } /* -------------------- Unexported Functions -------------------- */