fix(tui): require double-tap d to confirm session delete
Single-key confirm matches how the picker already accepts 1-9 to resume — no separate y/n keymap to learn — and "press d again" is self-documenting next to the cursor.
This commit is contained in:
committed by
Teknium
parent
24b5279f43
commit
49fcad8cf8
@@ -32,7 +32,7 @@ export function SessionPicker({ gw, onCancel, onSelect, t }: SessionPickerProps)
|
|||||||
const [sel, setSel] = useState(0)
|
const [sel, setSel] = useState(0)
|
||||||
const [loading, setLoading] = useState(true)
|
const [loading, setLoading] = useState(true)
|
||||||
// When non-null, the user pressed `d` on this index and we're waiting for
|
// When non-null, the user pressed `d` on this index and we're waiting for
|
||||||
// `y`/`Y` to confirm deletion. Any other key cancels the prompt.
|
// a second `d`/`D` to confirm deletion. Any other key cancels the prompt.
|
||||||
const [confirmDelete, setConfirmDelete] = useState<null | number>(null)
|
const [confirmDelete, setConfirmDelete] = useState<null | number>(null)
|
||||||
const [deleting, setDeleting] = useState(false)
|
const [deleting, setDeleting] = useState(false)
|
||||||
|
|
||||||
@@ -103,7 +103,7 @@ export function SessionPicker({ gw, onCancel, onSelect, t }: SessionPickerProps)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (confirmDelete !== null) {
|
if (confirmDelete !== null) {
|
||||||
if (ch === 'y' || ch === 'Y') {
|
if (ch?.toLowerCase() === 'd') {
|
||||||
const idx = confirmDelete
|
const idx = confirmDelete
|
||||||
setConfirmDelete(null)
|
setConfirmDelete(null)
|
||||||
performDelete(idx)
|
performDelete(idx)
|
||||||
@@ -128,7 +128,7 @@ export function SessionPicker({ gw, onCancel, onSelect, t }: SessionPickerProps)
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((ch === 'd' || ch === 'D') && items[sel]) {
|
if (ch?.toLowerCase() === 'd' && items[sel]) {
|
||||||
setConfirmDelete(sel)
|
setConfirmDelete(sel)
|
||||||
|
|
||||||
return
|
return
|
||||||
@@ -202,7 +202,7 @@ export function SessionPicker({ gw, onCancel, onSelect, t }: SessionPickerProps)
|
|||||||
inverse={selected}
|
inverse={selected}
|
||||||
wrap="truncate-end"
|
wrap="truncate-end"
|
||||||
>
|
>
|
||||||
{pendingDelete ? 'delete? y/n' : s.title || s.preview || '(untitled)'}
|
{pendingDelete ? 'press d again to delete' : s.title || s.preview || '(untitled)'}
|
||||||
</Text>
|
</Text>
|
||||||
</Box>
|
</Box>
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user