Skip to content

Commit 2cda4f9

Browse files
gulyasmjroimartin
authored andcommitted
adds BufferLines func to View
1 parent 491cd05 commit 2cda4f9

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

view.go

+12
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,18 @@ func (v *View) clearRunes() {
408408
}
409409
}
410410

411+
// BufferLines returns the lines in the view's internal
412+
// buffer.
413+
func (v *View) BufferLines() []string {
414+
lines := make([]string, len(v.lines))
415+
for i, l := range v.lines {
416+
str := lineType(l).String()
417+
str = strings.Replace(str, "\x00", " ", -1)
418+
lines[i] = str
419+
}
420+
return lines
421+
}
422+
411423
// Buffer returns a string with the contents of the view's internal
412424
// buffer.
413425
func (v *View) Buffer() string {

0 commit comments

Comments
 (0)