Fix selection extending issues#637
Open
liweitianux wants to merge 4 commits intolxqt:masterfrom
Open
Conversation
For debug builds, the function will fail when called with out of display coordinates, allowing to spot addressing errors. For regular builds, it will limit coordinates to valid area without triggering errors. Obtained-from: Konsole Commit: KDE/konsole@674de97
When a "word" (e.g., a path) wraps across the line and has a part scrolled off the visible screen, a double click previously could only select the visible part. This patch fixes the problem. Obtain-from: Konsole Commits: - KDE/konsole@914067d - KDE/konsole@4e09f08 - KDE/konsole@6d9d49a
When extendSelection() is called to extend a region, the "start" anchor may be scrolled off the visible screen. In that case, findWordStart() and findWordEnd() would cause out-of-bound access in loc(), which would either hit Q_ASSERT() to crash the program or clamp the (x,y) into the visible screen. Konsole "fixed" this issue by ensuring the point given to findWordStart() and findWordEnd() in the visible screen [1]. However, that would break the Shift+click range selection function. The correct fix is to correctly handle the initial out-of-screen pointer in findWordStart() and findWordEnd(), as we did here. [1] KDE/konsole@f7d54a6 Assisted-by: Claude Sonnet 4.5
The line selection mode (e.g., triple click) previously could only select the visible part of a line. Similar to findWordStart() and findWordEnd(), add findLineStart() and findLineEnd() to determine the line start and end, correctly handling the off-screen part of a line. Obtained-from: Konsole Commits: - KDE/konsole@6df0b5b - KDE/konsole@da08042 - KDE/konsole@4284d99
Member
|
Many thanks!
|
Member
|
Oh, my bad! I'd applied the patch incorrectly. It seems to work. Very sorry for my previous comment. |
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.
This PR fixes the selection extending that would go beyond the visible screen, for both word mode and line mode.
In addition, this fixes a related scrolling issue with Shift+click range selection: when the start anchor is scrolled off the visible screen, the Shift+click selected region becomes wrong, with the row number of the start anchor being changed to make it appear in the visible screen.