diff options
| author | citrons <citrons@mondecitronne.com> | 2025-06-07 18:08:52 -0500 |
|---|---|---|
| committer | citrons <citrons@mondecitronne.com> | 2025-06-07 18:08:52 -0500 |
| commit | 7d9933ccf0ac6fb9cafdd54a26a91bd9f1ed9a78 (patch) | |
| tree | 8d32f3a71db220f4c6867f32c834e83690ff3f52 /client | |
| parent | d56477d1668c675708f7f79018c2e8f171637615 (diff) | |
clearing preview no longer relies on empty log msg
Diffstat (limited to 'client')
| -rw-r--r-- | client/cmd_window.go | 16 |
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() } |
