Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit f7d54a69 authored by Martin Tobias Holmedahl Sandsmark's avatar Martin Tobias Holmedahl Sandsmark Committed by Kurt Hindenburg

Fix crash when extending selection

Summary:
When doing word selection use the previous selection anchor if the new one is out of bounds (user scrolled out of view or similar).

A more proper (but still not really proper) fix than b85bbaa8 reverted by 213afc0e

I have a branch refactoring the word selection stuff a bit, but it's a bit more invasive. This is the minimal change I could get to fix it.

Test Plan: see b85bbaa8 213afc0e 914067d1

Reviewers: hindenburg, pavelkh, ngraham

Reviewed By: hindenburg

Subscribers: konsole-devel

Tags: #konsole

Differential Revision: https://phabricator.kde.org/D18862
parent dd6cddfd
......@@ -2702,8 +2702,16 @@ void TerminalDisplay::extendSelection(const QPoint& position)
// Find left (left_not_right ? from end of word : from here)
QPoint right = left_not_right ? _iPntSelCorr : here;
left = findWordStart(left);
right = findWordEnd(right);
if (left.y() < 0 || left.y() >= _lines || left.x() < 0 || left.x() >= _columns) {
left = _pntSelCorr;
} else {
left = findWordStart(left);
}
if (right.y() < 0 || right.y() >= _lines || right.x() < 0 || right.x() >= _columns) {
right = _pntSelCorr;
} else {
right = findWordEnd(right);
}
// Pick which is start (ohere) and which is extension (here)
if (left_not_right) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment