Use a const for the mouse wheel delta in viewport

This commit is contained in:
Christian Muehlhaeuser 2021-03-12 01:27:41 +01:00
parent f719cc8cb1
commit 490a599c05

View File

@ -7,7 +7,10 @@ import (
tea "github.com/charmbracelet/bubbletea" tea "github.com/charmbracelet/bubbletea"
) )
const spacebar = " " const (
spacebar = " "
mouseWheelDelta = 3
)
// MODEL // MODEL
@ -333,13 +336,13 @@ func (m Model) Update(msg tea.Msg) (Model, tea.Cmd) {
case tea.MouseMsg: case tea.MouseMsg:
switch msg.Type { switch msg.Type {
case tea.MouseWheelUp: case tea.MouseWheelUp:
lines := m.LineUp(3) lines := m.LineUp(mouseWheelDelta)
if m.HighPerformanceRendering { if m.HighPerformanceRendering {
cmd = ViewUp(m, lines) cmd = ViewUp(m, lines)
} }
case tea.MouseWheelDown: case tea.MouseWheelDown:
lines := m.LineDown(3) lines := m.LineDown(mouseWheelDelta)
if m.HighPerformanceRendering { if m.HighPerformanceRendering {
cmd = ViewDown(m, lines) cmd = ViewDown(m, lines)
} }