Skip to content

Commit d2a8f1d

Browse files
committed
fix(anchor): preserve prompt line when reading user input
After reading user input in Reads(), clear the blank line created by Enter and position cursor correctly without erasing the prompt line. This prevents duplicate anchor lines and maintains proper TUI state.
1 parent 9b15361 commit d2a8f1d

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

sys/anchor/window.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,5 +167,13 @@ func (window *Window) Reads(label string, a ...interface{}) (value string) {
167167
value = strings.TrimSpace(value)
168168
value = strings.Trim(value, "\n")
169169
value = strings.Trim(value, "\r")
170+
171+
// Clear the blank line created by Enter, then move up to the prompt line without clearing it
172+
if !window.plain {
173+
cursor.ClearLine()
174+
cursor.Up(1)
175+
cursor.StartOfLine()
176+
}
177+
170178
return value
171179
}

0 commit comments

Comments
 (0)