[agent/codex:gpt-5.4-mini] Read ~/spec/code/core/go/cli/RFC.md fully. Find features des... #62
2 changed files with 17 additions and 3 deletions
|
|
@ -10,6 +10,7 @@ import (
|
|||
|
||||
tea "github.com/charmbracelet/bubbletea"
|
||||
"github.com/charmbracelet/lipgloss"
|
||||
"github.com/charmbracelet/x/ansi"
|
||||
"golang.org/x/term"
|
||||
)
|
||||
|
||||
|
|
@ -428,6 +429,7 @@ func (f *Frame) String() string {
|
|||
if view == "" {
|
||||
return ""
|
||||
}
|
||||
view = ansi.Strip(view)
|
||||
// Ensure trailing newline for non-TTY consistency
|
||||
if !strings.HasSuffix(view, "\n") {
|
||||
view += "\n"
|
||||
|
|
@ -452,7 +454,6 @@ func (f *Frame) termSize() (int, int) {
|
|||
return 80, 24 // sensible default
|
||||
}
|
||||
|
||||
|
||||
func (f *Frame) runLive() {
|
||||
opts := []tea.ProgramOption{
|
||||
tea.WithAltScreen(),
|
||||
|
|
|
|||
|
|
@ -145,6 +145,20 @@ func TestFrame_Bad(t *testing.T) {
|
|||
assert.Equal(t, "", f.String())
|
||||
})
|
||||
|
||||
t.Run("static string strips ANSI", func(t *testing.T) {
|
||||
f := NewFrame("HCF")
|
||||
f.out = &bytes.Buffer{}
|
||||
f.Header(StatusLine("core dev", "18 repos"))
|
||||
f.Content(StaticModel("body"))
|
||||
f.Footer(KeyHints("q quit"))
|
||||
|
||||
out := f.String()
|
||||
assert.NotContains(t, out, "\x1b[")
|
||||
assert.Contains(t, out, "core dev")
|
||||
assert.Contains(t, out, "body")
|
||||
assert.Contains(t, out, "q quit")
|
||||
})
|
||||
|
||||
t.Run("back on empty history", func(t *testing.T) {
|
||||
f := NewFrame("C")
|
||||
f.out = &bytes.Buffer{}
|
||||
|
|
@ -276,7 +290,7 @@ func TestFrameFocus_Good(t *testing.T) {
|
|||
|
||||
t.Run("Focus ignores invalid region", func(t *testing.T) {
|
||||
f := NewFrame("HCF")
|
||||
f.Focus(RegionLeft) // Left not in "HCF"
|
||||
f.Focus(RegionLeft) // Left not in "HCF"
|
||||
assert.Equal(t, RegionContent, f.Focused()) // unchanged
|
||||
})
|
||||
|
||||
|
|
@ -550,4 +564,3 @@ func TestFrameMessageRouting_Good(t *testing.T) {
|
|||
})
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue