mirror of
https://github.com/zoriya/bubbles.git
synced 2026-08-16 01:43:21 +00:00
Merge branch 'UnseenBook/master' into v2-exp
This commit is contained in:
+17
-3
@@ -140,9 +140,9 @@ func (m *Model) setInitialValues() {
|
|||||||
m.KeyMap = DefaultKeyMap()
|
m.KeyMap = DefaultKeyMap()
|
||||||
m.MouseWheelEnabled = true
|
m.MouseWheelEnabled = true
|
||||||
m.MouseWheelDelta = 3
|
m.MouseWheelDelta = 3
|
||||||
m.initialized = true
|
|
||||||
m.horizontalStep = defaultHorizontalStep
|
m.horizontalStep = defaultHorizontalStep
|
||||||
m.LeftGutterFunc = NoGutter
|
m.LeftGutterFunc = NoGutter
|
||||||
|
m.initialized = true
|
||||||
}
|
}
|
||||||
|
|
||||||
// Init exists to satisfy the tea.Model interface for composability purposes.
|
// Init exists to satisfy the tea.Model interface for composability purposes.
|
||||||
@@ -689,13 +689,27 @@ func (m Model) updateAsModel(msg tea.Msg) Model {
|
|||||||
if !m.MouseWheelEnabled {
|
if !m.MouseWheelEnabled {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
switch msg.Button {
|
switch msg.Button {
|
||||||
case tea.MouseWheelDown:
|
case tea.MouseWheelDown:
|
||||||
|
// NOTE: some terminal emulators don't send the shift event for
|
||||||
|
// mouse actions.
|
||||||
|
if msg.Mod.Contains(tea.ModShift) {
|
||||||
|
m.ScrollRight(m.horizontalStep)
|
||||||
|
break
|
||||||
|
}
|
||||||
m.ScrollDown(m.MouseWheelDelta)
|
m.ScrollDown(m.MouseWheelDelta)
|
||||||
|
|
||||||
case tea.MouseWheelUp:
|
case tea.MouseWheelUp:
|
||||||
|
// NOTE: some terminal emulators don't send the shift event for
|
||||||
|
// mouse actions.
|
||||||
|
if msg.Mod.Contains(tea.ModShift) {
|
||||||
|
m.ScrollLeft(m.horizontalStep)
|
||||||
|
break
|
||||||
|
}
|
||||||
m.ScrollUp(m.MouseWheelDelta)
|
m.ScrollUp(m.MouseWheelDelta)
|
||||||
|
case tea.MouseWheelLeft:
|
||||||
|
m.ScrollLeft(m.horizontalStep)
|
||||||
|
case tea.MouseWheelRight:
|
||||||
|
m.ScrollRight(m.horizontalStep)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user