pi-agent: Implement final TUI hardening

This commit is contained in:
proxyctl coordinator
2026-07-18 01:07:54 +08:00
parent 954e7d977a
commit f15ffc2301
10 changed files with 598 additions and 39 deletions
+4 -1
View File
@@ -148,6 +148,9 @@ func profileIndex(items []profile.Profile, name string) int {
func (p profilePickerState) view(snapshot app.Snapshot, width, height int) string {
search := p.search
search.Width = max(12, width-len(search.Prompt)-4)
position := search.Position()
search.SetValue(profile.ObscureURLForEditing(search.Value()))
search.SetCursor(position)
items := p.filtered(snapshot)
lines := make([]string, 0, len(items))
@@ -178,7 +181,7 @@ func (p profilePickerState) view(snapshot app.Snapshot, width, height int) strin
listHeight := max(2, height-5)
list := viewport.New(max(1, width), listHeight)
list.SetContent(strings.Join(lines, "\n"))
list.SetContent(protectRenderedText(strings.Join(lines, "\n")))
if selectedIndex >= listHeight {
list.SetYOffset(selectedIndex - listHeight + 1)
}