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

Function executeOpenLine

src/vim/operators.ts:397–416  ·  view source on GitHub ↗
(
  direction: 'above' | 'below',
  ctx: OperatorContext,
)

Source from the content-addressed store, hash-verified

395 * Execute open line (o/O command).
396 */
397export function executeOpenLine(
398 direction: 'above' | 'below',
399 ctx: OperatorContext,
400): void {
401 const text = ctx.text
402 const lines = text.split('\n')
403 const { line: currentLine } = ctx.cursor.getPosition()
404
405 const insertLine = direction === 'below' ? currentLine + 1 : currentLine
406 const newLines = [
407 ...lines.slice(0, insertLine),
408 '',
409 ...lines.slice(insertLine),
410 ]
411
412 const newText = newLines.join('\n')
413 ctx.setText(newText)
414 ctx.enterInsert(getLineStartOffset(newLines, insertLine))
415 ctx.recordChange({ type: 'openLine', direction })
416}
417
418// ============================================================================
419// Internal Helpers

Callers 2

handleNormalInputFunction · 0.85
replayLastChangeFunction · 0.85

Calls 2

getLineStartOffsetFunction · 0.85
getPositionMethod · 0.80

Tested by

no test coverage detected