pi-agent: Implement final TUI hardening
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user