File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -176,6 +176,18 @@ func (m *Login) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
176176 case "esc" :
177177 return m , func () tea.Msg { return GoToChoiceMenuMsg {} }
178178
179+ case "ctrl+v" :
180+ // Toggle password visibility while focused on the password field,
181+ // so typos in app-passwords are catchable without retyping.
182+ if m .focusIndex == inputPassword {
183+ if m .inputs [inputPassword ].EchoMode == textinput .EchoPassword {
184+ m .inputs [inputPassword ].EchoMode = textinput .EchoNormal
185+ } else {
186+ m .inputs [inputPassword ].EchoMode = textinput .EchoPassword
187+ }
188+ return m , nil
189+ }
190+
179191 case "enter" :
180192 m .updateFlags ()
181193 visible := m .visibleFields ()
@@ -417,7 +429,11 @@ func (m *Login) View() tea.View {
417429 if ! m .hideTips && tip != "" {
418430 views = append (views , TipStyle .Render ("Tip: " + tip ))
419431 }
420- views = append (views , helpStyle .Render ("\n enter: save • tab: next field • esc: back to menu" ))
432+ helpLine := "enter: save • tab: next field • esc: back to menu"
433+ if m .focusIndex == inputPassword {
434+ helpLine += " • ctrl+v: toggle password visibility"
435+ }
436+ views = append (views , helpStyle .Render ("\n " + helpLine ))
421437
422438 return tea .NewView (lipgloss .JoinVertical (lipgloss .Left , views ... ))
423439}
You can’t perform that action at this time.
0 commit comments