Preserve manual entry input on theme change in snapshot screen

Amolith created

Change summary

internal/ui/screens/snapshot.go | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

Detailed changes

internal/ui/screens/snapshot.go 🔗

@@ -90,6 +90,7 @@ func (s *Snapshot) Init() tea.Cmd {
 
 	if s.loader == nil {
 		s.phase = phaseSnapshotManual
+		s.entered = ""
 		s.buildManualForm()
 		return s.manualForm.Init()
 	}
@@ -269,8 +270,10 @@ func (s *Snapshot) rebuildSelectForm() {
 }
 
 // buildManualForm constructs the huh Input for manual snapshot ID entry.
+// It does not reset s.entered so that callers rebuilding the form for
+// theme changes preserve the user's input. Callers that start a fresh
+// entry (Init, switchToManual) reset s.entered explicitly.
 func (s *Snapshot) buildManualForm() {
-	s.entered = ""
 
 	input := huh.NewInput().
 		Title("Snapshot ID").
@@ -289,6 +292,7 @@ func (s *Snapshot) buildManualForm() {
 func (s *Snapshot) switchToManual(notice string) {
 	s.phase = phaseSnapshotManual
 	s.notice = notice
+	s.entered = ""
 	s.buildManualForm()
 }