Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenlib/intern/string_cursor_utf8.c
| Show First 20 Lines • Show All 210 Lines • ▼ Show 20 Lines | void BLI_str_cursor_step_utf8(const char *str, | ||||
| } | } | ||||
| } | } | ||||
| /* wchar_t version of BLI_str_cursor_step_utf8 (keep in sync!) | /* wchar_t version of BLI_str_cursor_step_utf8 (keep in sync!) | ||||
| * less complex since it doesn't need to do multi-byte stepping. | * less complex since it doesn't need to do multi-byte stepping. | ||||
| */ | */ | ||||
| /* helper funcs so we can match BLI_str_cursor_step_utf8 */ | /* helper funcs so we can match BLI_str_cursor_step_utf8 */ | ||||
| static bool wchar_t_step_next(const wchar_t *UNUSED(str), size_t maxlen, int *pos) | static bool wchar_t_step_next(const char32_t *UNUSED(str), size_t maxlen, int *pos) | ||||
| { | { | ||||
| if ((*pos) >= (int)maxlen) { | if ((*pos) >= (int)maxlen) { | ||||
| return false; | return false; | ||||
| } | } | ||||
| (*pos)++; | (*pos)++; | ||||
| return true; | return true; | ||||
| } | } | ||||
| static bool wchar_t_step_prev(const wchar_t *UNUSED(str), size_t UNUSED(maxlen), int *pos) | static bool wchar_t_step_prev(const char32_t *UNUSED(str), size_t UNUSED(maxlen), int *pos) | ||||
| { | { | ||||
| if ((*pos) <= 0) { | if ((*pos) <= 0) { | ||||
| return false; | return false; | ||||
| } | } | ||||
| (*pos)--; | (*pos)--; | ||||
| return true; | return true; | ||||
| } | } | ||||
| void BLI_str_cursor_step_wchar(const wchar_t *str, | void BLI_str_cursor_step_utf32(const char32_t *str, | ||||
| size_t maxlen, | size_t maxlen, | ||||
| int *pos, | int *pos, | ||||
| eStrCursorJumpDirection direction, | eStrCursorJumpDirection direction, | ||||
| eStrCursorJumpType jump, | eStrCursorJumpType jump, | ||||
| bool use_init_step) | bool use_init_step) | ||||
| { | { | ||||
| const int pos_orig = *pos; | const int pos_orig = *pos; | ||||
| ▲ Show 20 Lines • Show All 65 Lines • Show Last 20 Lines | |||||