diff options
| author | citrons <citrons@mondecitronne.com> | 2025-06-02 08:00:26 -0500 |
|---|---|---|
| committer | citrons <citrons@mondecitronne.com> | 2025-06-02 08:00:26 -0500 |
| commit | c9548e938589d730338db84c9649fed81c852705 (patch) | |
| tree | d1ed1254dc33c2b20ef0e1ec452af76b03c320c7 | |
| parent | 58281da28614386809eab60c9dcbb86082354f1b (diff) | |
command window preview
| -rw-r--r-- | client/cmd_window.go | 34 | ||||
| -rw-r--r-- | client/ui.go | 4 | ||||
| -rw-r--r-- | tui/layout.go | 4 |
3 files changed, 40 insertions, 2 deletions
diff --git a/client/cmd_window.go b/client/cmd_window.go index 4a1b664..261b550 100644 --- a/client/cmd_window.go +++ b/client/cmd_window.go @@ -107,6 +107,40 @@ func (w *cmdWindow) ShowStatusLine() { } } +func (w *cmdWindow) showPreview() { + bottom := w.buf.Bottom() + if bottom == nil { + return + } + msg := bottom.Msg() + + tui.Push("command window container", tui.Box { + Width: tui.Fill, Height: tui.Children, + }) + + tui.Push(msg.Id(), tui.Box {Width: tui.Fill, Height: tui.Children}) + msg.Show(false) + tui.Pop() + + tui.Push("command window border", tui.Box { + Width: tui.Fill, Height: 1, Dir: tui.Left, + Style: &tui.Style {Bg: tui.White, Fg: tui.Black}, + }) + + tui.Push("", tui.Box {Width: tui.Fill, Height: 1}) + tui.Pop() + + tui.Push("command window status", tui.Box { + Width: tui.TextSize, Height: 1, NoWrap: true, + }) + w.ShowStatusLine() + tui.Pop() + + tui.Pop() + + tui.Pop() +} + func (w *cmdWindow) loginMode() { w.login = true w.input.SetText("") diff --git a/client/ui.go b/client/ui.go index 37b7d4e..023a1bf 100644 --- a/client/ui.go +++ b/client/ui.go @@ -64,6 +64,10 @@ func (a *application) show() { Style: &tui.Style {Fg: tui.White, Bg: colorDefault[false]}, }) + if a.currentWindow != (cmdWindowLocation{}) { + a.cmdWindow.showPreview() + } + a.getWin().Buffer().Show("buffer") tui.Push("input border", tui.Box { Width: tui.Fill, Height: 1, Dir: tui.Left, diff --git a/tui/layout.go b/tui/layout.go index 2becbb8..3b70881 100644 --- a/tui/layout.go +++ b/tui/layout.go @@ -305,8 +305,8 @@ func (b *Box) computePositions(axis int) { } else { c.computedPosition += b.Scroll.absolute } - if c.computedPosition >= b.computedRect.min[axis] && - c.computedPosition < b.computedRect.max[axis] { + pos := c.computedPosition + b.computedRect.min[axis] + if c.computedPosition >= 0 && pos < b.computedRect.max[axis] { if firstShown == nil { firstShown = c } |
