From 2cda4f9f053925b85bba5f0af428f3b2e39dd171 Mon Sep 17 00:00:00 2001 From: gulyasm Date: Sun, 1 Apr 2018 16:03:12 +0200 Subject: [PATCH] adds BufferLines func to View --- view.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/view.go b/view.go index 9e4da4d..cd7bd0c 100644 --- a/view.go +++ b/view.go @@ -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. func (v *View) Buffer() string {