From 66ce56eb6e338c4d750c0ea769fcdd2b41ada0e1 Mon Sep 17 00:00:00 2001 From: Gokcehan Date: Sun, 21 Aug 2016 14:15:19 +0300 Subject: [PATCH] get rid of residual escape codes after skipping shell commands Some applications (e.g. vim) seem to leave behind escape codes in the terminal after quitting. For some terminals (including xterm and gnome-terminal) this is somehow interpreted as key strokes by lf. This is a temporary fix to get rid of these escape codes by restarting termbox until we can find a proper way to handle this. --- ui.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ui.go b/ui.go index 5aeff06..13aa7d5 100644 --- a/ui.go +++ b/ui.go @@ -484,6 +484,12 @@ func (ui *UI) sync() { } termbox.SetCursor(0, 0) termbox.HideCursor() + + // TODO: is there an easier way to clear residual escape codes? + termbox.Close() + if err := termbox.Init(); err != nil { + log.Fatalf("initializing termbox: %s", err) + } } func (ui *UI) listBinds(binds map[string]Expr) {