Merge branch 'codex/reject-invalid-background-opacity' of https://github.com/hezhizhen/kitty

This commit is contained in:
Kovid Goyal 2026-10-19 21:34:58 +05:30
commit 090003aab7
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C
3 changed files with 20 additions and 1 deletions

View file

@ -257,6 +257,9 @@ Detailed list of changes
- Remote control: Fix ``kitten @ action --match`` ignoring the match and
running the action on the active window (:iss:`10672`)
- Remote control: Fix ``kitten @ set-background-opacity`` treating invalid
numeric arguments as zero opacity instead of reporting an error
- ssh kitten: Fix hanging when re-using a shared connection whose connection
to the server has silently died, for example, after a network change or
suspend. Now the kitten detects this and reconnects (:iss:`10691`)

View file

@ -7,7 +7,7 @@ import "strconv"
func parse_opacity(arg string) (float64, error) {
ans, err := strconv.ParseFloat(arg, 64)
if err != nil {
return 0, nil
return 0, err
}
return max(0, min(ans, 1)), nil
}

View file

@ -0,0 +1,16 @@
// License: GPLv3 Copyright: 2026, kitty contributors
package at
import (
"testing"
"github.com/kovidgoyal/kitty/tools/utils"
)
func TestSetBackgroundOpacityRejectsInvalidNumber(t *testing.T) {
io_data := rc_io_data{rc: &utils.RemoteControlCmd{}}
if err := create_payload_set_background_opacity(&io_data, nil, []string{"oops"}); err == nil {
t.Fatalf("set-background-opacity accepted an invalid number: %#v", io_data.rc.Payload)
}
}