MCPcopy Index your code
hub / github.com/codeaashu/claude-code / up

Method up

src/utils/Cursor.ts:353–375  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

351 }
352
353 up(): Cursor {
354 const { line, column } = this.getPosition()
355 if (line === 0) {
356 return this
357 }
358
359 const prevLine = this.measuredText.getWrappedText()[line - 1]
360 if (prevLine === undefined) {
361 return this
362 }
363
364 const prevLineDisplayWidth = stringWidth(prevLine)
365 if (column > prevLineDisplayWidth) {
366 const newOffset = this.getOffset({
367 line: line - 1,
368 column: prevLineDisplayWidth,
369 })
370 return new Cursor(this.measuredText, newOffset, 0)
371 }
372
373 const newOffset = this.getOffset({ line: line - 1, column })
374 return new Cursor(this.measuredText, newOffset, 0)
375 }
376
377 down(): Cursor {
378 const { line, column } = this.getPosition()

Callers 2

applySingleMotionFunction · 0.80
upOrHistoryUpFunction · 0.80

Calls 3

getPositionMethod · 0.95
getOffsetMethod · 0.95
getWrappedTextMethod · 0.80

Tested by

no test coverage detected