Fix selecting between tab (or other control characters) in the UI

It wasn't possible to select the position between two tab characters
with the mouse cursor in the UI. Don't handle characters with an unknown
width as combining.

Follow up to [0] which changed this for cursor motion.

[0]: bc51449ff1a8f2083c5b06998f1b448f184357ea
This commit is contained in:
Campbell Barton 2023-09-17 15:41:37 +10:00
parent 5ae99270c1
commit 0464b9fc58

@ -989,8 +989,8 @@ size_t blf_str_offset_from_cursor_position(FontBLF *font,
/* We are to the right of the string, so return position of null terminator. */
data.r_offset = BLI_strnlen(str, str_len);
}
else if (BLI_str_utf8_char_width(&str[data.r_offset]) < 1) {
/* This is a combining character (or invalid), so move to previous visible valid char. */
else if (BLI_str_utf8_char_width(&str[data.r_offset]) == 0) {
/* This is a combining character, so move to previous visible valid char. */
int offset = int(data.r_offset);
BLI_str_cursor_step_prev_utf8(str, str_len, &offset);
data.r_offset = size_t(offset);