adds BufferLines func to View

This commit is contained in:
gulyasm 2018-04-01 16:03:12 +02:00 committed by Roi Martin
parent 491cd051cf
commit 2cda4f9f05
1 changed files with 12 additions and 0 deletions

12
view.go
View File

@ -408,6 +408,18 @@ func (v *View) clearRunes() {
} }
} }
// BufferLines returns the lines in the view's internal
// buffer.
func (v *View) BufferLines() []string {
lines := make([]string, len(v.lines))
for i, l := range v.lines {
str := lineType(l).String()
str = strings.Replace(str, "\x00", " ", -1)
lines[i] = str
}
return lines
}
// Buffer returns a string with the contents of the view's internal // Buffer returns a string with the contents of the view's internal
// buffer. // buffer.
func (v *View) Buffer() string { func (v *View) Buffer() string {