fix(renderer): use visual width for table wrap check#518
Closed
ImmanuelHaffner wants to merge 1 commit into
Closed
fix(renderer): use visual width for table wrap check#518ImmanuelHaffner wants to merge 1 commit into
ImmanuelHaffner wants to merge 1 commit into
Conversation
The table wrap check used vim_width (raw text width including concealed content like URLs) to decide whether to skip rendering. This caused tables with long hyperlinks to not render at all when wrap is enabled, even though the visual width after conceal was well within the window. The whole table lost its padding and borders, so column-2 right borders appeared shifted far off, worsening with URL length. Use col_widths (visual width after conceal resolution) instead, which correctly reflects the rendered table width. Add test/table_wrap_link_border.md as a visual repro (wrap enabled, long URLs in cells); every column-2 right border must align once the cursor is off the table and the URLs conceal.
Owner
|
@ImmanuelHaffner text wrapping is separate from conceals. They are incompatible at the moment. The lines total width(before concealing) is used for text wrapping which is why you can see empty lines when long links are wrapped. This needs to be fixed upstream. The solution given in this PR was already tested before, it doesn't work correctly in a lot edge cases. |
This file contains hidden or 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
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.
The table wrap check used
vim_width(raw text width including concealed content like URLs) to decide whether to skip rendering. This caused tables with long hyperlinks to not render at all whenwrapis enabled, even though the visual width after conceal was well within the window. The whole table lost its padding and borders, so column-2 right borders appeared shifted far off, worsening with URL length.Use
col_widths(visual width after conceal resolution) instead, which correctly reflects the rendered table width.Adds
test/table_wrap_link_border.mdas a visual repro (wrap enabled, long URLs in cells); with the fix, every column-2 right border aligns once the cursor is off the table and the URLs conceal.