fix(lint): address staticcheck findings
- commit
- c92982216c39031bff748837b569794d8daba635
- author
- brice · · 2026-08-23 08:39 UTC
- parent
- b4be9db
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
3 files · +4 -7
M graphics/scene.go +1 -1
| @@ -739,7 +739,7 @@ func (s *Snapshot) Asset(id AssetID) (AssetView, bool) { | |||
| 739 | 739 | if !ok { | |
| 740 | 740 | return AssetView{}, false | |
| 741 | 741 | } | |
| 742 | - | return AssetView{id: record.id, encoded: record.encoded, width: record.width, height: record.height, pixels: record.pixels}, true | |
| 742 | + | return AssetView(record), true | |
| 743 | 743 | } | |
| 744 | 744 | ||
| 745 | 745 | // GetAsset is an alias for Asset. | |
| @@ -739,7 +739,7 @@ func (s *Snapshot) Asset(id AssetID) (AssetView, bool) { | |||||
| 739 | if !ok { | 739 | if !ok { | ||
| 740 | return AssetView{}, false | 740 | return AssetView{}, false | ||
| 741 | } | 741 | } | ||
| 742 | - | return AssetView{id: record.id, encoded: record.encoded, width: record.width, height: record.height, pixels: record.pixels}, true | 742 | + | return AssetView(record), true |
| 743 | } | 743 | } | ||
| 744 | 744 | ||||
| 745 | // GetAsset is an alias for Asset. | 745 | // GetAsset is an alias for Asset. | ||
M protocol/kittygraphics/session.go +1 -4
| @@ -135,10 +135,7 @@ func (s *Session) Finish() (Result, error) { | |||
| 135 | 135 | } | |
| 136 | 136 | s.mu.Lock() | |
| 137 | 137 | defer s.mu.Unlock() | |
| 138 | - | result := Result{} | |
| 139 | - | for _, event := range s.parser.Finish() { | |
| 140 | - | result.Events = append(result.Events, event) | |
| 141 | - | } | |
| 138 | + | result := Result{Events: s.parser.Finish()} | |
| 142 | 139 | if len(result.Events) != 0 { | |
| 143 | 140 | return result, result.Events[0].Err | |
| 144 | 141 | } | |
| @@ -135,10 +135,7 @@ func (s *Session) Finish() (Result, error) { | |||||
| 135 | } | 135 | } | ||
| 136 | s.mu.Lock() | 136 | s.mu.Lock() | ||
| 137 | defer s.mu.Unlock() | 137 | defer s.mu.Unlock() | ||
| 138 | - | result := Result{} | 138 | + | result := Result{Events: s.parser.Finish()} |
| 139 | - | for _, event := range s.parser.Finish() { | |||
| 140 | - | result.Events = append(result.Events, event) | |||
| 141 | - | } | |||
| 142 | if len(result.Events) != 0 { | 139 | if len(result.Events) != 0 { | ||
| 143 | return result, result.Events[0].Err | 140 | return result, result.Events[0].Err | ||
| 144 | } | 141 | } | ||
M screen.go +2 -2
| @@ -408,7 +408,7 @@ func (s *Screen) dispatchKittyGraphics(apc []byte) { | |||
| 408 | 408 | movementControls = *pending | |
| 409 | 409 | } | |
| 410 | 410 | if display && !continuation { | |
| 411 | - | if !(controls.HasMore && controls.More == 1) { | |
| 411 | + | if !controls.HasMore || controls.More != 1 { | |
| 412 | 412 | if !controls.HasX { | |
| 413 | 413 | controls.X, controls.HasX = s.kittyCursorX(), true | |
| 414 | 414 | } | |
| @@ -419,7 +419,7 @@ func (s *Screen) dispatchKittyGraphics(apc []byte) { | |||
| 419 | 419 | } | |
| 420 | 420 | movementControls = controls | |
| 421 | 421 | } | |
| 422 | - | if display && continuation && !(controls.HasMore && controls.More == 1) { | |
| 422 | + | if display && continuation && (!controls.HasMore || controls.More != 1) { | |
| 423 | 423 | s.graphics.kitty.SetPendingPlacement(s.kittyCursorX(), s.kittyCursorY()) | |
| 424 | 424 | } | |
| 425 | 425 | if display && controls.HasMore && controls.More == 1 { | |
| @@ -408,7 +408,7 @@ func (s *Screen) dispatchKittyGraphics(apc []byte) { | |||||
| 408 | movementControls = *pending | 408 | movementControls = *pending | ||
| 409 | } | 409 | } | ||
| 410 | if display && !continuation { | 410 | if display && !continuation { | ||
| 411 | - | if !(controls.HasMore && controls.More == 1) { | 411 | + | if !controls.HasMore || controls.More != 1 { |
| 412 | if !controls.HasX { | 412 | if !controls.HasX { | ||
| 413 | controls.X, controls.HasX = s.kittyCursorX(), true | 413 | controls.X, controls.HasX = s.kittyCursorX(), true | ||
| 414 | } | 414 | } | ||
| @@ -419,7 +419,7 @@ func (s *Screen) dispatchKittyGraphics(apc []byte) { | |||||
| 419 | } | 419 | } | ||
| 420 | movementControls = controls | 420 | movementControls = controls | ||
| 421 | } | 421 | } | ||
| 422 | - | if display && continuation && !(controls.HasMore && controls.More == 1) { | 422 | + | if display && continuation && (!controls.HasMore || controls.More != 1) { |
| 423 | s.graphics.kitty.SetPendingPlacement(s.kittyCursorX(), s.kittyCursorY()) | 423 | s.graphics.kitty.SetPendingPlacement(s.kittyCursorX(), s.kittyCursorY()) | ||
| 424 | } | 424 | } | ||
| 425 | if display && controls.HasMore && controls.More == 1 { | 425 | if display && controls.HasMore && controls.More == 1 { | ||