-
Notifications
You must be signed in to change notification settings - Fork 106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improved option management, add hook management #516
Open
tony
wants to merge
47
commits into
master
Choose a base branch
from
improved-options
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6cd43f0
to
3399c7d
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #516 +/- ##
==========================================
- Coverage 88.54% 85.16% -3.38%
==========================================
Files 36 42 +6
Lines 3927 4893 +966
Branches 570 698 +128
==========================================
+ Hits 3477 4167 +690
- Misses 308 500 +192
- Partials 142 226 +84 ☔ View full report in Codecov by Sentry. |
Closed
e5c6186
to
37898a4
Compare
97d74c1
to
36c5907
Compare
…parse array" objects and for those to set
…evel, "sparse array" objects and for those to set" This reverts commit 9dc876d.
src/libtmux/window.py:848: error: Returning Any from function declared to return "dict[str, Any]" [no-any-return]
9c58f4d
to
92daa0c
Compare
- Update SparseArray type parameter to include all value types - Add proper type checking for both dict and SparseArray cases - Fix return type casting in _show_option method - Resolve mypy errors related to string indexing of SparseArray
- Add version-specific assertions for terminal features - Handle rxvt* features in tmux 3.4+ - Make test more robust by checking individual features
WHAT: - Add comprehensive test coverage for complex option values and edge cases - Add tests for terminal features edge cases including empty/malformed features - Add tests for style validation and error handling - Fix type safety issues in terminal features tests WHY: - Ensure proper handling of tmux's complex option types: * Empty feature lists (tmux returns [''] not []) * Malformed feature strings with colons * Features containing spaces and special chars - Improve type safety by: * Adding proper type assertions for runtime checks * Using t.cast() to handle complex union types * Fixing string vs int indexing for SparseArray - Make tests more maintainable by: * Breaking complex assertions into steps * Using descriptive variable names * Adding clear comments about tmux behavior
WHAT: - Add type assertions for style option values - Convert style values to strings before comparison - Fix mypy errors in test_style_option_validation WHY: - Ensure type safety when handling style option values - Prevent potential runtime errors from type mismatches - Make test assertions more robust and explicit
1b81fb2
to
9f02afd
Compare
WHAT: - Add version check for status-format option (added in tmux 2.9) - Update test assertions to handle version-specific behavior WHY: - Ensure tests pass on older tmux versions - Properly handle version-specific options - Improve test robustness across tmux versions
WHAT: - Add version check for update-environment option (added in tmux 3.0) - Update test assertions to handle version-specific behavior - Add type checking for update-environment value WHY: - Ensure tests pass on older tmux versions - Properly handle version-specific options - Improve test robustness across tmux versions
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Extracted from #513
Warning
APIs below are subject to change (both params, return types, and structures)
Changes
New internal:
OptionsMixin
show_options()
: High level objects, e.g. preserving sparse-array data such ascommand-alias[1]
,command-alias[99]
, and inside of a dataclass object.command_alias
:SparseArray({0: {'split-pane': 'split-window'})
_show_options()
: Map of options split up by key, with raw values.command-alias[1] split-pane=split-window
_show_options_raw()
: Raw stdout fromtmux show-options
Individual options:
show_option()
: High level objects, e.g. preserving sparse-array data such ascommand-alias[1]
,command-alias[99]
Not sure if this will scale, but will try to get this:
_show_option()
:_show_option_raw()
: Raw stdout fromtmux show-option [option name]
New internal:
HooksMixin
New features
Window.set_option()
Learned params:
format
->-F
unset
->-u
global
->-g
unset_panes
->-U
: Also unset other panse in windowsprevent_overwrite
:-o
suppress_warnings
:-q
append
:-a
Window.show_option()
Window.show_options()
Breaking changes
Deprecations
Window.set_window_option()
in favor ofWindow.set_option()
Window.show_window_option()
in favor ofWindow.show_option()
Window.show_window_options()
in favor ofWindow.show_options()
Summary by Sourcery
Refactor option and hook management, deprecating old methods.
New Features:
OptionsMixin
to manage tmux options.HooksMixin
to manage tmux hooks.show_option()
,show_options()
, andset_option()
.run_hook()
,set_hook()
,show_hooks()
,show_hook()
, andunset_hook()
.SparseArray
to handle sparse arrays in options and hooks.Tests: