Browse Source

(tui) tweak: add setting for scroll speed (#1288)

Aiden Cline 7 months ago
parent
commit
22c9e2942b

+ 1 - 0
packages/tui/internal/app/state.go

@@ -23,6 +23,7 @@ type ModeModel struct {
 
 type State struct {
 	Theme              string               `toml:"theme"`
+	ScrollSpeed        *int                 `toml:"scroll_speed"`
 	ModeModel          map[string]ModeModel `toml:"mode_model"`
 	Provider           string               `toml:"provider"`
 	Model              string               `toml:"model"`

+ 6 - 1
packages/tui/internal/components/chat/messages.go

@@ -1015,7 +1015,12 @@ func (m *messagesComponent) RedoLastMessage() (tea.Model, tea.Cmd) {
 func NewMessagesComponent(app *app.App) MessagesComponent {
 	vp := viewport.New()
 	vp.KeyMap = viewport.KeyMap{}
-	vp.MouseWheelDelta = 4
+
+	if app.State.ScrollSpeed != nil && *app.State.ScrollSpeed > 0 {
+		vp.MouseWheelDelta = *app.State.ScrollSpeed
+	} else {
+		vp.MouseWheelDelta = 4
+	}
 
 	return &messagesComponent{
 		app:             app,