mirror of https://github.com/rivo/tview.git
Added TextView.GetOriginalLineCount().
This commit is contained in:
parent
1f7581b67b
commit
5962c4c9a7
11
textview.go
11
textview.go
|
@ -323,9 +323,10 @@ func (t *TextView) SetText(text string) *TextView {
|
|||
// to true, any region/color tags are stripped from the text.
|
||||
func (t *TextView) GetText(stripAllTags bool) string {
|
||||
// Get the buffer.
|
||||
buffer := make([]string, len(t.buffer), len(t.buffer)+1)
|
||||
copy(buffer, t.buffer)
|
||||
buffer := t.buffer
|
||||
if !stripAllTags {
|
||||
buffer = make([]string, len(t.buffer), len(t.buffer)+1)
|
||||
copy(buffer, t.buffer)
|
||||
buffer = append(buffer, string(t.recentBytes))
|
||||
}
|
||||
|
||||
|
@ -348,6 +349,12 @@ func (t *TextView) GetText(stripAllTags bool) string {
|
|||
return text
|
||||
}
|
||||
|
||||
// GetOriginalLineCount returns the number of lines in the original text buffer,
|
||||
// i.e. the number of newline characters plus one.
|
||||
func (t *TextView) GetOriginalLineCount() int {
|
||||
return len(t.buffer)
|
||||
}
|
||||
|
||||
// SetDynamicColors sets the flag that allows the text color to be changed
|
||||
// dynamically. See class description for details.
|
||||
func (t *TextView) SetDynamicColors(dynamic bool) *TextView {
|
||||
|
|
Loading…
Reference in New Issue