MCPcopy Create free account
hub / github.com/claude-code-best/claude-code / upOrHistoryUp

Function upOrHistoryUp

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

Source from the content-addressed store, hash-verified

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

Callers 1

useTextInputFunction · 0.85

Calls 3

upMethod · 0.80
upLogicalLineMethod · 0.80
equalsMethod · 0.45

Tested by

no test coverage detected