-
Notifications
You must be signed in to change notification settings - Fork 3
fix: handle tab on tmux next3.6 #3
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
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes tab handling in tmux-easymotion by updating the functions that compute character widths and true positions.
- Added a new helper function calculate_tab_width and updated get_char_width, get_string_width, and get_true_position to account for tab characters.
- Extended tests in test_easymotion.py to verify the updated handling of tabs.
- Updated documentation in CLAUDE.md to reflect recent changes.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
test_easymotion.py | New tests to verify tab width and true position with tab characters. |
easymotion.py | Updated tab handling by refactoring character width, string width, and true position calculations; added calculate_tab_width. |
CLAUDE.md | Updated documentation for project guidance. |
Comments suppressed due to low confidence (1)
easymotion.py:562
- The visual position calculation code in the CASE_SENSITIVE and non-case-sensitive branches of find_matches is duplicated. Consider refactoring this logic into a separate helper function to reduce repetition and improve maintainability.
if CASE_SENSITIVE:
"""Get visual width of a single character with caching | ||
|
||
Args: | ||
char: The character to measure | ||
position: The visual position of the character (needed for tabs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] It may be beneficial to update the docstring of get_char_width to explicitly mention how the position parameter affects tab width calculation and caching behavior.
"""Get visual width of a single character with caching | |
Args: | |
char: The character to measure | |
position: The visual position of the character (needed for tabs) | |
"""Get visual width of a single character with caching. | |
This function calculates the visual width of a character, taking into account | |
special cases like tab characters and wide East Asian characters. The result | |
is cached to improve performance for repeated calls with the same arguments. | |
Args: | |
char: The character to measure. | |
position: The visual position of the character in the line. This is used | |
to calculate the width of tab characters (`\t`) based on their position, | |
as tab width depends on alignment. Different `position` values will | |
result in different cache keys, which can affect performance and memory | |
usage. | |
Returns: | |
The visual width of the character. |
Copilot uses AI. Check for mistakes.
merge this after tmux 3.6 released