MCPcopy
hub / github.com/c-bata/go-prompt / JoinNextLine

Method JoinNextLine

buffer.go:165–172  ·  view source on GitHub ↗

JoinNextLine joins the next line to the current one by deleting the line ending after the current line.

(separator string)

Source from the content-addressed store, hash-verified

163
164// JoinNextLine joins the next line to the current one by deleting the line ending after the current line.
165func (b *Buffer) JoinNextLine(separator string) {
166 if !b.Document().OnLastLine() {
167 b.cursorPosition += b.Document().GetEndOfLinePosition()
168 b.Delete(1)
169 // Remove spaces
170 b.setText(b.Document().TextBeforeCursor() + separator + strings.TrimLeft(b.Document().TextAfterCursor(), " "))
171 }
172}
173
174// SwapCharactersBeforeCursor swaps the last two characters before the cursor.
175func (b *Buffer) SwapCharactersBeforeCursor() {

Callers 1

TestBuffer_JoinNextLineFunction · 0.95

Calls 7

DocumentMethod · 0.95
DeleteMethod · 0.95
setTextMethod · 0.95
OnLastLineMethod · 0.80
GetEndOfLinePositionMethod · 0.80
TextBeforeCursorMethod · 0.80
TextAfterCursorMethod · 0.80

Tested by 1

TestBuffer_JoinNextLineFunction · 0.76