mirror of
https://github.com/kovidgoyal/kitty.git
synced 2026-11-18 14:18:16 +00:00
Merge branch 'codex/reject-invalid-background-opacity' of https://github.com/hezhizhen/kitty
This commit is contained in:
commit
090003aab7
3 changed files with 20 additions and 1 deletions
|
|
@ -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`)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
16
tools/cmd/at/set_background_opacity_test.go
Normal file
16
tools/cmd/at/set_background_opacity_test.go
Normal 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)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue