textview.go
func (l *TextView) LoadFile(filename string) bool {
	l.lines = make([]string, 0)

	file, err := os.Open(filename)
	if err != nil {
		return false
	}

	defer file.Close()

	scanner := bufio.NewScanner(file)
	for scanner.Scan() {
		line := scanner.Text()
		line = strings.TrimSpace(line)
		l.lines = append(l.lines, line)
	}

	l.applyLimit()
	l.calculateVirtualSize()

	if l.autoscroll {
		l.end()
	}

	return true
}
func (l *TextView) LoadFile(filename string) bool {
	l.lines = make([]string, 0)

	file, err := os.Open(filename)
	if err != nil {
		return false
	}

	defer file.Close()

	scanner := bufio.NewScanner(file)
	for scanner.Scan() {
		line := scanner.Text()
		line = strings.TrimSpace(line)
		l.lines = append(l.lines, line)
	}

	l.applyLimit()
	l.calculateVirtualSize()

	if l.autoscroll {
		l.end()
	}

	return true
}
// LoadFile loads a text from file and replace the control
// text with the file one.
// Function returns false if loading text from file fails