func ScrollUp(m *TuiModel) {
	if m.UI.FormatModeEnabled && m.UI.CanFormatScroll && m.Viewport.YOffset > 0 && m.Viewport.YPosition != 0 {
		m.Viewport.YOffset--
		return
	}
	if m.Viewport.YOffset > 0 {
		m.Viewport.YOffset--
		m.MouseData.Y = Min(m.MouseData.Y, m.Viewport.YOffset)
	} else {
		m.MouseData.Y = HeaderHeight
	}
	if !m.UI.RenderSelection {
		m.Scroll.PreScrollYPosition = m.MouseData.Y
		m.Scroll.PreScrollYOffset = m.Viewport.YOffset
	}
}
ScrollUp is a simple function to move the Viewport up
package viewer
import (
	"fmt"
	tea "github.com/charmbracelet/bubbletea"
	"github.com/charmbracelet/lipgloss"
	"github.com/muesli/reflow/wordwrap"
	"strconv"
	"strings"
	"termdbms/tuiutil"
	"time"
)
var (
	Program          *tea.Program
	FormatModeOffset int
	TUIWidth         int
	TUIHeight        int
)
func GetOffsetForLineNumber(a int) int {
	return FormatModeOffset - len(strconv.Itoa(a))
}
func SelectOption(m *TuiModel) {
	if m.UI.RenderSelection {
		return
	}
	m.UI.RenderSelection = true
	raw, _, col := m.GetSelectedOption()
	if raw == nil {
		return
	}
	l := len(col)
	row := m.Viewport.YOffset + m.MouseData.Y - HeaderHeight
	if row <= l && l > 0 &&
		m.MouseData.Y >= HeaderHeight &&
		m.MouseData.Y < m.Viewport.Height+HeaderHeight &&
		m.MouseData.X < m.CellWidth()*(len(m.Data().TableHeadersSlice)) {
		if conv, ok := (*raw).(string); ok {
			m.Data().EditTextBuffer = conv
		} else {
			m.Data().EditTextBuffer = ""
		}
	} else {
		m.UI.RenderSelection = false
	}
}
func ScrollDown(m *TuiModel) {
	if m.UI.FormatModeEnabled && m.UI.CanFormatScroll && m.Viewport.YPosition != 0 {
		m.Viewport.YOffset++
		return
	}
	max := GetScrollDownMaximumForSelection(m)
	if m.Viewport.YOffset < max-m.Viewport.Height {
		m.Viewport.YOffset++
		m.MouseData.Y = Min(m.MouseData.Y, m.Viewport.YOffset)
	}
	if !m.UI.RenderSelection {
		m.Scroll.PreScrollYPosition = m.MouseData.Y
		m.Scroll.PreScrollYOffset = m.Viewport.YOffset
	}
}