adds ViewBufferLines to View

This commit is contained in:
gulyasm 2018-04-11 17:50:10 +02:00 committed by Roi Martin
parent 2cda4f9f05
commit c055c87ae8
1 changed files with 12 additions and 0 deletions

12
view.go
View File

@ -430,6 +430,18 @@ func (v *View) Buffer() string {
return strings.Replace(str, "\x00", " ", -1)
}
// ViewBufferLines returns the lines in the view's internal
// buffer that is shown to the user.
func (v *View) ViewBufferLines() []string {
lines := make([]string, len(v.viewLines))
for i, l := range v.viewLines {
str := lineType(l.line).String()
str = strings.Replace(str, "\x00", " ", -1)
lines[i] = str
}
return lines
}
// ViewBuffer returns a string with the contents of the view's buffer that is
// shown to the user.
func (v *View) ViewBuffer() string {