fix: Add koding mode handling for backspace/delete to prevent premature mode change

Similar to the bash mode fix, ensure koding mode only exits when deleting
the last character (#) instead of exiting prematurely during deletion.
This commit is contained in:
CrazyBoyM 2025-08-24 05:17:21 +08:00
parent 90a5d2db64
commit 7abf61b804

View File

@ -493,6 +493,17 @@ function PromptInput({
}
return
}
// For koding mode, only exit when deleting the last character (which would be the '#' character)
if (mode === 'koding' && (key.backspace || key.delete)) {
// Check the current input state, not the inputChar parameter
// If current input is empty, we're about to delete the '#' character, so exit koding mode
if (input === '') {
onModeChange('prompt')
}
return
}
// For other modes, keep the original behavior
if (inputChar === '' && (key.escape || key.backspace || key.delete)) {
onModeChange('prompt')