Skip to content

Fix #6454: Expand tabs in Static widget before visualization#6484

Open
hugomath133 wants to merge 1 commit intoTextualize:mainfrom
hugomath133:fix/selection-tab-expansion
Open

Fix #6454: Expand tabs in Static widget before visualization#6484
hugomath133 wants to merge 1 commit intoTextualize:mainfrom
hugomath133:fix/selection-tab-expansion

Conversation

@hugomath133
Copy link
Copy Markdown

@hugomath133 hugomath133 commented Apr 8, 2026

image

Description:

This PR fixes issue #6454 where text selection offsets were incorrect when tab characters (\t) were present.

Changes:

Updated Static widget to expand tabs using self._app.tab_size (defaulting to 8) before visualization.

Handled cases where the widget might not be attached to an app (preventing NoActiveAppError).

Verification:

Verified with a reproduction script: selection now correctly identifies the column offset.

Ran tests/test_static.py and all tests passed.

@TomJGooding
Copy link
Copy Markdown
Collaborator

TomJGooding commented Apr 8, 2026

I don't understand why this only targets Static rather than a wider fix for other widgets? Was this PR generated using AI?

@hugomath133
Copy link
Copy Markdown
Author

I focused on Static because it was the specific widget where I encountered and reproduced the issue (Issue #6454). You're right that a more global fix would be better. I'm new to the codebase and wanted to ensure a working fix for the reported bug first.

Regarding the AI, I used some assistance to navigate the framework's internals and handle the NoActiveAppError during unittests, but I've manually verified the fix with reproduction scripts and existing tests.

I'd be happy to move this logic to a more central place (like the base Widget class or the visualize function) if you can point me to where you'd prefer this tab expansion to happen.

@TomJGooding
Copy link
Copy Markdown
Collaborator

No thanks, if I wanted to prompt an AI agent I'd just do it myself.

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.

2 participants