diff kitten: Fix wheel_scroll_multiplier not being respected
Fixes #9054
This commit is contained in:
parent
7f24dd68c9
commit
9a4b52f8b9
2 changed files with 8 additions and 4 deletions
|
|
@ -661,7 +661,7 @@ def generate_constants() -> str:
|
|||
var CommentedOutDefaultConfig = "{serialize_as_go_string(commented_out_default_config())}"
|
||||
var KittyConfigDefaults = struct {{
|
||||
Term, Shell_integration, Select_by_word_characters, Url_excluded_characters, Shell string
|
||||
Wheel_scroll_multiplier int
|
||||
Wheel_scroll_multiplier float64
|
||||
Url_prefixes []string
|
||||
}}{{
|
||||
Term: "{Options.term}", Shell_integration: "{' '.join(Options.shell_integration)}", Url_prefixes: []string{{ {url_prefixes} }},
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ package diff
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"math"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
|
|
@ -20,7 +21,7 @@ import (
|
|||
var _ = fmt.Print
|
||||
|
||||
type KittyOpts struct {
|
||||
Wheel_scroll_multiplier int
|
||||
Wheel_scroll_multiplier float64
|
||||
Copy_on_select bool
|
||||
}
|
||||
|
||||
|
|
@ -29,7 +30,7 @@ func read_relevant_kitty_opts() KittyOpts {
|
|||
handle_line := func(key, val string) error {
|
||||
switch key {
|
||||
case "wheel_scroll_multiplier":
|
||||
v, err := strconv.Atoi(val)
|
||||
v, err := strconv.ParseFloat(val, 64)
|
||||
if err == nil {
|
||||
ans.Wheel_scroll_multiplier = v
|
||||
}
|
||||
|
|
@ -47,7 +48,10 @@ var RelevantKittyOpts = sync.OnceValue(func() KittyOpts {
|
|||
})
|
||||
|
||||
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 {
|
||||
amt *= -1
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue