Fix #122047: Correct text selection when text is scrolled

Correct calculation of start of visual string and position of the
selection start when the text is scrolled (showing a subset of the
text) within an input box.

Pull Request: https://projects.blender.org/blender/blender/pulls/122110
This commit is contained in:
Harley Acheson
2024-05-22 19:40:37 +02:00
committed by Harley Acheson
parent 86c56050f1
commit 643f23f4ed

View File

@@ -1946,9 +1946,9 @@ static void widget_draw_text(const uiFontStyle *fstyle,
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
immUniformColor4ubv(wcol->item);
const auto boxes = BLF_str_selection_boxes(fstyle->uifont_id,
drawstr,
drawstr + but->ofs,
strlen(drawstr),
but->ofs + but->selsta,
but->selsta - but->ofs,
but->selend - but->selsta);
for (auto bounds : boxes) {
immRecti(pos,