From c055c87ae801372cd74a0839b972db4f7697ae5f Mon Sep 17 00:00:00 2001 From: gulyasm Date: Wed, 11 Apr 2018 17:50:10 +0200 Subject: [PATCH] adds ViewBufferLines to View --- view.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/view.go b/view.go index cd7bd0c..42082f8 100644 --- a/view.go +++ b/view.go @@ -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 {