Merge pull request #131 from Askhz/fix/ctrl-enter-newline
fix: 修复 Ctrl+Enter 在标准终端中应插入换行而非发送消息
This commit is contained in:
commit
9481d58c2b
|
|
@ -697,12 +697,17 @@ function parseKeypress(s: string = ''): ParsedKey {
|
|||
return createNavKey(s, 'mouse', false)
|
||||
}
|
||||
|
||||
if (s === '\r' || s === '\r\n') {
|
||||
if (s === '\r\n') {
|
||||
key.raw = undefined
|
||||
key.name = 'return'
|
||||
key.ctrl = true
|
||||
} else if (s === '\r') {
|
||||
key.raw = undefined
|
||||
key.name = 'return'
|
||||
} else if (s === '\n') {
|
||||
key.raw = undefined
|
||||
key.name = 'return'
|
||||
key.ctrl = true
|
||||
} else if (s === '\t') {
|
||||
key.name = 'tab'
|
||||
} else if (s === '\b' || s === '\x1b\b') {
|
||||
|
|
|
|||
|
|
@ -71,6 +71,9 @@ export const DEFAULT_BINDINGS: KeybindingBlock[] = [
|
|||
'meta+o': 'chat:fastMode',
|
||||
'meta+t': 'chat:thinkingToggle',
|
||||
enter: 'chat:submit',
|
||||
// Ctrl+Enter inserts a newline (Kitty keyboard protocol terminals only;
|
||||
// standard terminals cannot distinguish ctrl+enter from plain enter).
|
||||
'ctrl+enter': 'chat:newline',
|
||||
up: 'history:previous',
|
||||
down: 'history:next',
|
||||
// Editing shortcuts (defined here, migration in progress)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user