From c74ebf14710bc3b819ab816c95752531b14cd526 Mon Sep 17 00:00:00 2001 From: makeworld Date: Sat, 27 Feb 2021 21:11:09 -0500 Subject: [PATCH] Add TextDimensions --- textview.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/textview.go b/textview.go index c723563..e723881 100644 --- a/textview.go +++ b/textview.go @@ -1317,3 +1317,12 @@ func (t *TextView) MouseHandler() func(action MouseAction, event *tcell.EventMou return }) } + +// TextDimensions returns the number of lines in the text buffer and the length +// of the longest line in the buffer. This is the dimensions of the text buffer. +// This is not the dimensions of the TextView on the screen. +func (t *TextView) TextDimensions() (int, int) { + t.Lock() + defer t.Unlock() + return t.longestLine, len(t.buffer) +}