MCPcopy
hub / github.com/codeaashu/claude-code / handleEnter

Function handleEnter

src/hooks/useTextInput.ts:247–267  ·  view source on GitHub ↗
(key: Key)

Source from the content-addressed store, hash-verified

245 ])
246
247 function handleEnter(key: Key) {
248 if (
249 multiline &&
250 cursor.offset > 0 &&
251 cursor.text[cursor.offset - 1] === '\\'
252 ) {
253 // Track that the user has used backslash+return
254 markBackslashReturnUsed()
255 return cursor.backspace().insert('\n')
256 }
257 // Meta+Enter or Shift+Enter inserts a newline
258 if (key.meta || key.shift) {
259 return cursor.insert('\n')
260 }
261 // Apple Terminal doesn't support custom Shift+Enter keybindings,
262 // so we use native macOS modifier detection to check if Shift is held
263 if (env.terminal === 'Apple_Terminal' && isModifierPressed('shift')) {
264 return cursor.insert('\n')
265 }
266 onSubmit?.(originalValue)
267 }
268
269 function upOrHistoryUp() {
270 if (disableCursorMovementForUpDownKeys) {

Callers 2

mapKeyFunction · 0.85
handleKeyDownFunction · 0.85

Calls 5

markBackslashReturnUsedFunction · 0.85
isModifierPressedFunction · 0.85
onSubmitFunction · 0.85
insertMethod · 0.45
backspaceMethod · 0.45

Tested by

no test coverage detected