Fix(terminal-emulator): Trim synthetic wide-char trailing blank on copy (#1397)#5046
Open
Sayeem3051 wants to merge 4 commits intotermux:masterfrom
Open
Fix(terminal-emulator): Trim synthetic wide-char trailing blank on copy (#1397)#5046Sayeem3051 wants to merge 4 commits intotermux:masterfrom
Sayeem3051 wants to merge 4 commits intotermux:masterfrom
Conversation
…copy (termux#1397) Fixes termux#1397 When a double-width (CJK) character wraps at the end of a line, the terminal inserts a placeholder space in the last column. This commit adds logic to trim that synthetic trailing blank during copy operations when the preceding copied character is double-width, while preserving legitimate trailing spaces on wrapped lines. Changes only TerminalBuffer.getSelectedText() - no changes to rendering, storage, or wrapping logic.
Revert the previous wrapped-line copy heuristic. The earlier change trimmed a trailing space when the preceding copied character had width 2, but that condition is too broad and can remove legitimate trailing spaces on wrapped lines. This restores the original wrapped-line behavior in getSelectedText() until a narrower fix can identify the synthetic wrap placeholder safely.
Remove the remaining wrapped-line trimming heuristic from getSelectedText(). The previous logic still attempted to infer a synthetic trailing blank from copied text state, which can trim legitimate trailing spaces on wrapped lines. This restores the original wrapped-line behavior fully.
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.
…copy (#1397)
Fixes #1397
When a double-width (CJK) character wraps at the end of a line, the terminal inserts a placeholder space in the last column. This commit adds logic to trim that synthetic trailing blank during copy operations when the preceding copied character is double-width, while preserving legitimate trailing spaces on wrapped lines.
Changes only TerminalBuffer.getSelectedText() - no changes to rendering, storage, or wrapping logic.