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

Function upOrHistoryUp

src/hooks/useTextInput.ts:269–292  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

267 }
268
269 function upOrHistoryUp() {
270 if (disableCursorMovementForUpDownKeys) {
271 onHistoryUp?.()
272 return cursor
273 }
274 // Try to move by wrapped lines first
275 const cursorUp = cursor.up()
276 if (!cursorUp.equals(cursor)) {
277 return cursorUp
278 }
279
280 // If we can't move by wrapped lines and this is multiline input,
281 // try to move by logical lines (to handle paragraph boundaries)
282 if (multiline) {
283 const cursorUpLogical = cursor.upLogicalLine()
284 if (!cursorUpLogical.equals(cursor)) {
285 return cursorUpLogical
286 }
287 }
288
289 // Can't move up at all - trigger history navigation
290 onHistoryUp?.()
291 return cursor
292 }
293 function downOrHistoryDown() {
294 if (disableCursorMovementForUpDownKeys) {
295 onHistoryDown?.()

Callers 1

useTextInputFunction · 0.85

Calls 3

upMethod · 0.80
upLogicalLineMethod · 0.80
equalsMethod · 0.45

Tested by

no test coverage detected