UI: Anchor Right When Double-Clicking Last Word

In UI text inputs, when double-clicking to select words, anchor (set
initial selection position) to the right if on the last word. This
aids in some combined double-click-drag operations.

Pull Request: https://projects.blender.org/blender/blender/pulls/113125
This commit is contained in:
Harley Acheson
2023-10-01 18:51:10 +02:00
committed by Harley Acheson
parent eda7926834
commit 8a2e81b16b

View File

@@ -3803,7 +3803,8 @@ static void ui_do_but_textedit(
but->pos = short(selend);
but->selsta = short(selsta);
but->selend = short(selend);
data->sel_pos_init = selsta;
/* Anchor selection to the left side unless the last word. */
data->sel_pos_init = ((selend == strlen(data->str)) && (selsta != 0)) ? selend : selsta;
retval = WM_UI_HANDLER_BREAK;
changed = true;
}