mirror of
https://github.com/kovidgoyal/kitty
synced 2026-06-06 01:05:48 +02:00
diff kitten: Fix wheel_scroll_multiplier not being respected
Fixes #9054
This commit is contained in:
@@ -661,7 +661,7 @@ var QueryNames = []string{{ {query_names} }}
|
|||||||
var CommentedOutDefaultConfig = "{serialize_as_go_string(commented_out_default_config())}"
|
var CommentedOutDefaultConfig = "{serialize_as_go_string(commented_out_default_config())}"
|
||||||
var KittyConfigDefaults = struct {{
|
var KittyConfigDefaults = struct {{
|
||||||
Term, Shell_integration, Select_by_word_characters, Url_excluded_characters, Shell string
|
Term, Shell_integration, Select_by_word_characters, Url_excluded_characters, Shell string
|
||||||
Wheel_scroll_multiplier int
|
Wheel_scroll_multiplier float64
|
||||||
Url_prefixes []string
|
Url_prefixes []string
|
||||||
}}{{
|
}}{{
|
||||||
Term: "{Options.term}", Shell_integration: "{' '.join(Options.shell_integration)}", Url_prefixes: []string{{ {url_prefixes} }},
|
Term: "{Options.term}", Shell_integration: "{' '.join(Options.shell_integration)}", Url_prefixes: []string{{ {url_prefixes} }},
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ package diff
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"math"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
@@ -20,7 +21,7 @@ import (
|
|||||||
var _ = fmt.Print
|
var _ = fmt.Print
|
||||||
|
|
||||||
type KittyOpts struct {
|
type KittyOpts struct {
|
||||||
Wheel_scroll_multiplier int
|
Wheel_scroll_multiplier float64
|
||||||
Copy_on_select bool
|
Copy_on_select bool
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -29,7 +30,7 @@ func read_relevant_kitty_opts() KittyOpts {
|
|||||||
handle_line := func(key, val string) error {
|
handle_line := func(key, val string) error {
|
||||||
switch key {
|
switch key {
|
||||||
case "wheel_scroll_multiplier":
|
case "wheel_scroll_multiplier":
|
||||||
v, err := strconv.Atoi(val)
|
v, err := strconv.ParseFloat(val, 64)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
ans.Wheel_scroll_multiplier = v
|
ans.Wheel_scroll_multiplier = v
|
||||||
}
|
}
|
||||||
@@ -47,7 +48,10 @@ var RelevantKittyOpts = sync.OnceValue(func() KittyOpts {
|
|||||||
})
|
})
|
||||||
|
|
||||||
func (self *Handler) handle_wheel_event(up bool) {
|
func (self *Handler) handle_wheel_event(up bool) {
|
||||||
amt := RelevantKittyOpts().Wheel_scroll_multiplier
|
amt := int(math.Round(RelevantKittyOpts().Wheel_scroll_multiplier))
|
||||||
|
if amt == 0 {
|
||||||
|
amt = 1
|
||||||
|
}
|
||||||
if up {
|
if up {
|
||||||
amt *= -1
|
amt *= -1
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user