func (l *TableView) EnsureColVisible() {
	if l.isColVisible(l.selectedCol) {
		return
	}

	if l.selectedCol < l.topCol {
		l.topCol = l.selectedCol
		return
	}

	width := l.width - 1 - l.counterWidth()
	if l.showRowNo && l.showVLines {
		width--
	}

	toShow := l.selectedCol
	for width > 0 {
		if l.columns[toShow].Width > width {
			if toShow == l.selectedCol {
				break
			} else {
				toShow++
				break
			}
		} else if l.columns[toShow].Width == width {
			break
		} else {
			width -= l.columns[toShow].Width
			if width < 0 {
				break
			}
			toShow--
			if toShow == 0 {
				break
			}
		}
	}

	l.topCol = toShow
}
func (l *TableView) EnsureColVisible() {
	if l.isColVisible(l.selectedCol) {
		return
	}

	if l.selectedCol < l.topCol {
		l.topCol = l.selectedCol
		return
	}

	width := l.width - 1 - l.counterWidth()
	if l.showRowNo && l.showVLines {
		width--
	}

	toShow := l.selectedCol
	for width > 0 {
		if l.columns[toShow].Width > width {
			if toShow == l.selectedCol {
				break
			} else {
				toShow++
				break
			}
		} else if l.columns[toShow].Width == width {
			break
		} else {
			width -= l.columns[toShow].Width
			if width < 0 {
				break
			}
			toShow--
			if toShow == 0 {
				break
			}
		}
	}

	l.topCol = toShow
}
func ( l * TableView ) EnsureColVisible ( ) { if l . isColVisible ( l . selectedCol ) { return } if l . selectedCol < l . topCol { l . topCol = l . selectedCol return } width := l . width - 1 - l . counterWidth ( ) if l . showRowNo && l . showVLines { width -- } toShow := l . selectedCol for width > 0 { if l . columns [ toShow ] . Width > width { if toShow == l . selectedCol { break } else { toShow ++ break } } else if l . columns [ toShow ] . Width == width { break } else { width -= l . columns [ toShow ] . Width if width < 0 { break } toShow -- if toShow == 0 { break } } } l . topCol = toShow }
// EnsureColVisible scrolls the table horizontally
// to make the currently selected column fully visible
EnsureColVisible scrolls the table horizontally to make the currently selected column fully visible