fix(ui): Cyrillic text input, PgDn, and q closing layers before quitting
- Russian-layout translation applies only to command keys; mkdir, rename, filter and the SSH form receive the typed runes (U-P1-5) - PgDn is bound (U-P1-6); help text no longer promises an unbound 'b' - q with the info pane, a filter or a selection closes that layer like Esc and quits only from the bare browser; q no longer closes the SSH form while typing (U-P1-16, partial) - smoke tests for PgDn and Cyrillic mkdir are no longer skipped Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
6696fea67a
commit
2ba00b0ad0
5 changed files with 116 additions and 9 deletions
|
|
@ -837,7 +837,11 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
|||
return m, nil
|
||||
|
||||
case tea.KeyMsg:
|
||||
msg = translateKeyMsg(msg)
|
||||
// Russian-layout letters are mapped to their Latin keys only when
|
||||
// the key is a command; text fields get the original runes (U-P1-5).
|
||||
if !m.textInputActive() {
|
||||
msg = translateKeyMsg(msg)
|
||||
}
|
||||
if msg.String() != "y" {
|
||||
m.pendingY = false
|
||||
}
|
||||
|
|
@ -1047,6 +1051,12 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
|||
}
|
||||
_ = remotePrefix // used in logs below
|
||||
|
||||
// "q" first closes whatever layer is open (filter, info pane,
|
||||
// selection), like Esc; it quits only from the bare browser (U-P1-16).
|
||||
if msg.String() == "q" && m.hasClosableLayer() {
|
||||
msg = tea.KeyMsg{Type: tea.KeyEsc}
|
||||
}
|
||||
|
||||
switch {
|
||||
case key.Matches(msg, m.keys.Quit):
|
||||
log.Printf("[KEY] Quit — exiting application")
|
||||
|
|
@ -1497,7 +1507,7 @@ func (m Model) handleModalKey(msg tea.KeyMsg) (tea.Model, tea.Cmd) {
|
|||
|
||||
case modalSSHConnect:
|
||||
switch {
|
||||
case isModalCloseKey(msg, m.keys):
|
||||
case key.Matches(msg, m.keys.Cancel): // not "q": it is typed into the form
|
||||
log.Printf("[MODAL] SSH connect — cancelled (Esc)")
|
||||
m.modal = modalState{}
|
||||
if m.ssh != nil && m.ssh.testingConn {
|
||||
|
|
@ -1654,6 +1664,29 @@ func (m Model) handleModalKey(msg tea.KeyMsg) (tea.Model, tea.Cmd) {
|
|||
|
||||
// isModalNoKey is the "n" answer of yes/no dialogs (their notes promise
|
||||
// "Esc / n to cancel"). Not used by dialogs with text input.
|
||||
// textInputActive reports whether keys currently go to a text field.
|
||||
func (m *Model) textInputActive() bool {
|
||||
switch m.modal.kind {
|
||||
case modalMkdir, modalRename, modalSSHConnect:
|
||||
return true
|
||||
case modalNone:
|
||||
return m.filterMode && !m.viewMode
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// hasClosableLayer reports whether Esc/q would close something in browse
|
||||
// mode instead of doing nothing (Esc) or quitting (q).
|
||||
func (m *Model) hasClosableLayer() bool {
|
||||
if m.filterQuery != "" && m.filterPaneID == m.active {
|
||||
return true
|
||||
}
|
||||
if m.infoMode {
|
||||
return true
|
||||
}
|
||||
return len(m.activePane().MarkedEntries()) > 0
|
||||
}
|
||||
|
||||
func isModalNoKey(msg tea.KeyMsg) bool {
|
||||
return msg.String() == "n" || msg.String() == "N"
|
||||
}
|
||||
|
|
@ -3173,7 +3206,7 @@ func (m *Model) openHelpModal() {
|
|||
" k / Up move up",
|
||||
" Shift+Down/J extend selection down",
|
||||
" Shift+Up/K extend selection up",
|
||||
" PgUp / b page up",
|
||||
" PgUp / PgDn page up / down",
|
||||
" Enter / Right open selected entry",
|
||||
" Backspace/Left go to parent directory",
|
||||
" Tab / h / l switch active pane",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue