|
Blender V4.3
|
#include <stdio.h>#include <stdlib.h>#include "BLI_string_utf8.h"#include "BLI_utildefines.h"#include "BLI_string_cursor_utf8.h"#include "BLI_strict_flags.h"Go to the source code of this file.
Typedefs | |
| typedef enum eStrCursorDelimType | eStrCursorDelimType |
Functions | |
| static eStrCursorDelimType | cursor_delim_type_unicode (const uint uch) |
| static eStrCursorDelimType | cursor_delim_type_utf8 (const char *ch_utf8, const int ch_utf8_len, const int pos) |
| bool | BLI_str_cursor_step_next_utf8 (const char *str, const int str_maxlen, int *pos) |
| bool | BLI_str_cursor_step_prev_utf8 (const char *str, const int str_maxlen, int *pos) |
| void | BLI_str_cursor_step_utf8 (const char *str, const int str_maxlen, int *pos, eStrCursorJumpDirection direction, eStrCursorJumpType jump, bool use_init_step) |
| bool | BLI_str_cursor_step_next_utf32 (const char32_t *str, const int str_maxlen, int *pos) |
| bool | BLI_str_cursor_step_prev_utf32 (const char32_t *str, const int str_maxlen, int *pos) |
| void | BLI_str_cursor_step_utf32 (const char32_t *str, const int str_maxlen, int *pos, eStrCursorJumpDirection direction, eStrCursorJumpType jump, bool use_init_step) |
| void | BLI_str_cursor_step_bounds_utf8 (const char *str, const int str_maxlen, const int pos, int *r_start, int *r_end) |
| void | BLI_str_cursor_step_bounds_utf32 (const char32_t *str, const int str_maxlen, const int pos, int *r_start, int *r_end) |
| typedef enum eStrCursorDelimType eStrCursorDelimType |
The category of character as returned by cursor_delim_type_unicode.
For range calculation the order prioritizes expansion direction, when the cursor is between two different categories, "hug" the smaller values. Where white-space gets lowest priority. See BLI_str_cursor_step_bounds_utf8. This is done so expanding the range at a word boundary always chooses the word instead of the white-space before or after it.
| enum eStrCursorDelimType |
The category of character as returned by cursor_delim_type_unicode.
For range calculation the order prioritizes expansion direction, when the cursor is between two different categories, "hug" the smaller values. Where white-space gets lowest priority. See BLI_str_cursor_step_bounds_utf8. This is done so expanding the range at a word boundary always chooses the word instead of the white-space before or after it.
| Enumerator | |
|---|---|
| STRCUR_DELIM_NONE | |
| STRCUR_DELIM_ALPHANUMERIC | |
| STRCUR_DELIM_PUNCT | |
| STRCUR_DELIM_BRACE | |
| STRCUR_DELIM_OPERATOR | |
| STRCUR_DELIM_QUOTE | |
| STRCUR_DELIM_OTHER | |
| STRCUR_DELIM_WHITESPACE | |
Definition at line 31 of file string_cursor_utf8.c.
| void BLI_str_cursor_step_bounds_utf32 | ( | const char32_t * | str, |
| int | str_maxlen, | ||
| int | pos, | ||
| int * | r_start, | ||
| int * | r_end ) |
A UTF32 version of BLI_str_cursor_step_bounds_utf8
Definition at line 401 of file string_cursor_utf8.c.
References BLI_assert, BLI_str_cursor_step_utf32(), cursor_delim_type_unicode(), next, pos, str, STRCUR_DELIM_NONE, STRCUR_DIR_NEXT, STRCUR_DIR_PREV, and STRCUR_JUMP_DELIM.
Referenced by font_select_word_exec().
| void BLI_str_cursor_step_bounds_utf8 | ( | const char * | str, |
| int | str_maxlen, | ||
| int | pos, | ||
| int * | r_start, | ||
| int * | r_end ) |
Given a position within a string, return the start and end of the closest sequence of delimited characters. Typically a word, but can be a sequence of characters (including spaces).
r_end (by convention).| str | The string with a cursor position |
| str_maxlen | The maximum characters to consider |
| pos | The starting cursor position. |
| r_start | returned start of word/sequence boundary (0-based) |
| r_end | returned end of word/sequence boundary (0-based) |
Definition at line 372 of file string_cursor_utf8.c.
References BLI_assert, BLI_str_cursor_step_utf8(), cursor_delim_type_utf8(), next, pos, str, STRCUR_DELIM_NONE, STRCUR_DIR_NEXT, STRCUR_DIR_PREV, and STRCUR_JUMP_DELIM.
Referenced by console_selectword_invoke(), text_select_word_exec(), and ui_do_but_textedit().
Definition at line 261 of file string_cursor_utf8.c.
References BLI_assert, BLI_wcwidth_or_error(), pos, and str.
Referenced by BLI_str_cursor_step_utf32(), delete_exec(), move_cursor(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().
Definition at line 137 of file string_cursor_utf8.c.
References BLI_assert, BLI_str_find_next_char_utf8(), BLI_str_utf8_char_width_or_error(), int, pos, and str.
Referenced by BLI_str_cursor_step_utf8(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), txt_delete_char(), and txt_move_right().
Definition at line 277 of file string_cursor_utf8.c.
References BLI_assert, BLI_wcwidth_or_error(), pos, str, and UNUSED_VARS_NDEBUG.
Referenced by BLI_str_cursor_step_utf32(), delete_exec(), move_cursor(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().
Definition at line 161 of file string_cursor_utf8.c.
References BLI_assert, BLI_str_find_prev_char_utf8(), BLI_str_utf8_char_width_or_error(), int, pos, and str.
Referenced by blf_str_offset_from_cursor_position(), BLI_str_cursor_step_utf8(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), txt_backspace_char(), txt_move_left(), and ui_textedit_set_cursor_pos().
| void BLI_str_cursor_step_utf32 | ( | const char32_t * | str, |
| const int | str_maxlen, | ||
| int * | pos, | ||
| eStrCursorJumpDirection | direction, | ||
| eStrCursorJumpType | jump, | ||
| bool | use_init_step ) |
Definition at line 294 of file string_cursor_utf8.c.
References BLI_assert, BLI_assert_unreachable, BLI_str_cursor_step_next_utf32(), BLI_str_cursor_step_prev_utf32(), cursor_delim_type_unicode(), jump(), pos, str, STRCUR_DELIM_NONE, STRCUR_DIR_NEXT, STRCUR_DIR_PREV, STRCUR_JUMP_ALL, STRCUR_JUMP_DELIM, and STRCUR_JUMP_NONE.
Referenced by BLI_str_cursor_step_bounds_utf32(), delete_exec(), and move_cursor().
| void BLI_str_cursor_step_utf8 | ( | const char * | str, |
| const int | str_maxlen, | ||
| int * | pos, | ||
| eStrCursorJumpDirection | direction, | ||
| eStrCursorJumpType | jump, | ||
| bool | use_init_step ) |
Definition at line 180 of file string_cursor_utf8.c.
References BLI_assert, BLI_assert_unreachable, BLI_str_cursor_step_next_utf8(), BLI_str_cursor_step_prev_utf8(), cursor_delim_type_utf8(), jump(), pos, str, STRCUR_DELIM_NONE, STRCUR_DIR_NEXT, STRCUR_DIR_PREV, STRCUR_JUMP_ALL, STRCUR_JUMP_DELIM, and STRCUR_JUMP_NONE.
Referenced by BLI_str_cursor_step_bounds_utf8(), console_delete_exec(), console_move_exec(), handleNumInput(), txt_jump_left(), txt_jump_right(), ui_textedit_delete(), and ui_textedit_move().
|
static |
Definition at line 42 of file string_cursor_utf8.c.
References STRCUR_DELIM_ALPHANUMERIC, STRCUR_DELIM_BRACE, STRCUR_DELIM_OPERATOR, STRCUR_DELIM_OTHER, STRCUR_DELIM_PUNCT, STRCUR_DELIM_QUOTE, and STRCUR_DELIM_WHITESPACE.
Referenced by BLI_str_cursor_step_bounds_utf32(), BLI_str_cursor_step_utf32(), and cursor_delim_type_utf8().
|
static |
Definition at line 125 of file string_cursor_utf8.c.
References BLI_assert, BLI_str_utf8_as_unicode_step_or_error(), cursor_delim_type_unicode(), and pos.
Referenced by BLI_str_cursor_step_bounds_utf8(), and BLI_str_cursor_step_utf8().