MCPcopy Index your code
hub / github.com/claude-code-best/claude-code / handleEnter

Function handleEnter

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

Source from the content-addressed store, hash-verified

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

Callers 2

mapKeyFunction · 0.85
handleKeyDownFunction · 0.85

Calls 5

markBackslashReturnUsedFunction · 0.85
insertMethod · 0.80
backspaceMethod · 0.80
isModifierPressedFunction · 0.50
onSubmitFunction · 0.50

Tested by

no test coverage detected