Fix #111278: UI Text Extension of Selection

Recent refactors could cause movement of selection endpoints when
extending (holding shift). This ensures that only the cursor side moves
during selection extension.

Pull Request: https://projects.blender.org/blender/blender/pulls/111288
This commit is contained in:
Harley Acheson
2023-08-19 19:19:57 +02:00
committed by Harley Acheson
parent 5a8cb665e0
commit b25b13a90b

View File

@@ -3237,10 +3237,18 @@ static void ui_textedit_move(uiBut *but,
if (select) {
if (has_sel == false) {
data->sel_pos_init = pos_prev;
/* Holding shift but with no previous selection. */
but->selsta = but->pos;
but->selend = pos_prev;
}
else if (but->selsta == pos_prev) {
/* Previous selection, extending start position. */
but->selsta = but->pos;
}
else {
/* Previous selection, extending end position. */
but->selend = but->pos;
}
but->selsta = but->pos;
but->selend = data->sel_pos_init;
}
if (but->selend < but->selsta) {
std::swap(but->selsta, but->selend);