summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--client/cmd_window.go16
1 files changed, 6 insertions, 10 deletions
diff --git a/client/cmd_window.go b/client/cmd_window.go
index b1435be..62fdeee 100644
--- a/client/cmd_window.go
+++ b/client/cmd_window.go
@@ -11,6 +11,7 @@ type cmdWindowLocation struct {}
type cmdWindow struct {
window.DefaultWindow
+ previewClearedAt string
}
type logMsg struct {
@@ -76,6 +77,10 @@ func (w *cmdWindow) ShowStatusLine() {
}
func (w *cmdWindow) showPreview() {
+ if w.previewClearedAt == w.Buf.Bottom().Msg().Id() {
+ return
+ }
+
bottom := w.Buf.Bottom()
if bottom == nil {
return
@@ -139,15 +144,6 @@ func (w *cmdWindow) cmd(f string, a ...any) {
w.Buf.Add(logMsg {lastIndex, fmt.Sprintf(f, a...), logCmd})
}
-type clearPreviewMsg int
-
-func (c clearPreviewMsg) Id() string {
- return fmt.Sprintf("clear.%d", int(c))
-}
-
-func (c clearPreviewMsg) Show(bool) {}
-
func (w *cmdWindow) clearPreview() {
- lastIndex++
- w.Buf.Add(clearPreviewMsg(lastIndex))
+ w.previewClearedAt = w.Buf.Bottom().Msg().Id()
}