Merge branch 'master' into 'master'

Add TextDimensions

See merge request tslocum/cview!14
This commit is contained in:
Trevor Slocum 2021-03-27 21:26:44 +00:00
commit 29e91c0bc5
1 changed files with 9 additions and 0 deletions

View File

@ -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.RLock()
defer t.RUnlock()
return t.longestLine, len(t.buffer)
}