Skip to content

layout command: return success on noop when layout already matches#1954

Open
glassbe wants to merge 1 commit intonikitabobko:mainfrom
glassbe:fix/layout-noop-return-success
Open

layout command: return success on noop when layout already matches#1954
glassbe wants to merge 1 commit intonikitabobko:mainfrom
glassbe:fix/layout-noop-return-success

Conversation

@glassbe
Copy link

@glassbe glassbe commented Feb 15, 2026

Discussion: #1956

Summary

  • The layout command returns false (exit code 1) when the layout is already set to the requested value, even though the desired state is already achieved.
  • Changed return false to return true on the noop path (line 15 of LayoutCommand.swift), consistent with how the tiling case already returns true for noops (line 41).

Test plan

  • Added LayoutCommandTest.swift with 2 tests:
    • testChangeLayout — verifies layout actually changes and returns exit code 0
    • testNoopReturnsTrueWhenLayoutAlreadyMatches — verifies the noop case returns exit code 0
  • ./run-tests.sh passes (108 tests, 0 SwiftFormat changes)

🤖 Generated with Claude Code

When `layout` is called with the same layout that is already set (e.g.,
running `layout h_tiles` when the container is already h_tiles), the
command returns false (exit code 1) even though the desired state is
already achieved. This makes scripting and programmatic use harder since
callers must special-case exit code 1 as a non-error.

Change `return false` to `return true` so that noops are treated as
successful operations, consistent with how the `tiling` case on line 41
already handles this.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant