MCPcopy Create free account
hub / github.com/AnukarOP/claude-code-leaked / up

Method up

source code/utils/Cursor.ts:355–377  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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