From c78f02d9908773ec29d10b31c9401bb17eb5eacb Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 7 Mar 2012 16:24:25 +0000 Subject: edit to cursor adjustment, use int rather then short to store the cursor position. --- source/blender/blenlib/BLI_string_cursor_utf8.h | 17 +++-------------- source/blender/blenlib/intern/string_cursor_utf8.c | 16 +++++++++++++--- 2 files changed, 16 insertions(+), 17 deletions(-) (limited to 'source/blender/blenlib') diff --git a/source/blender/blenlib/BLI_string_cursor_utf8.h b/source/blender/blenlib/BLI_string_cursor_utf8.h index 4bdc7f612c6..11c91aac6ac 100644 --- a/source/blender/blenlib/BLI_string_cursor_utf8.h +++ b/source/blender/blenlib/BLI_string_cursor_utf8.h @@ -30,17 +30,6 @@ * \ingroup bli */ -typedef enum strCursorDelimType { - STRCUR_DELIM_NONE, - STRCUR_DELIM_ALPHA, - STRCUR_DELIM_PUNCT, - STRCUR_DELIM_BRACE, - STRCUR_DELIM_OPERATOR, - STRCUR_DELIM_QUOTE, - STRCUR_DELIM_WHITESPACE, - STRCUR_DELIM_OTHER -} strCursorDelimType; - typedef enum strCursorJumpType { STRCUR_JUMP_NONE, STRCUR_JUMP_DELIM, @@ -52,11 +41,11 @@ typedef enum strCursorJumpDirection { STRCUR_DIR_NEXT } strCursorJumpDirection; -int BLI_str_cursor_step_next_utf8(const char *str, size_t maxlen, short *pos); -int BLI_str_cursor_step_prev_utf8(const char *str, size_t maxlen, short *pos); +int BLI_str_cursor_step_next_utf8(const char *str, size_t maxlen, int *pos); +int BLI_str_cursor_step_prev_utf8(const char *str, size_t maxlen, int *pos); void BLI_str_cursor_step_utf8(const char *str, size_t maxlen, - short *pos, strCursorJumpDirection direction, + int *pos, strCursorJumpDirection direction, strCursorJumpType jump); #endif /* __BLI_STRING_CURSOR_UTF8_H__ */ diff --git a/source/blender/blenlib/intern/string_cursor_utf8.c b/source/blender/blenlib/intern/string_cursor_utf8.c index 6dc88ec00a4..7fdeaf35514 100644 --- a/source/blender/blenlib/intern/string_cursor_utf8.c +++ b/source/blender/blenlib/intern/string_cursor_utf8.c @@ -36,6 +36,16 @@ #include "BLI_string_cursor_utf8.h" /* own include */ +typedef enum strCursorDelimType { + STRCUR_DELIM_NONE, + STRCUR_DELIM_ALPHA, + STRCUR_DELIM_PUNCT, + STRCUR_DELIM_BRACE, + STRCUR_DELIM_OPERATOR, + STRCUR_DELIM_QUOTE, + STRCUR_DELIM_WHITESPACE, + STRCUR_DELIM_OTHER +} strCursorDelimType; /* return 1 if char ch is special character, otherwise return 0 */ static strCursorDelimType test_special_char(const char ch) @@ -100,7 +110,7 @@ static strCursorDelimType test_special_char(const char ch) return STRCUR_DELIM_NONE; } -int BLI_str_cursor_step_next_utf8(const char *str, size_t maxlen, short *pos) +int BLI_str_cursor_step_next_utf8(const char *str, size_t maxlen, int *pos) { const char *str_end= str + (maxlen + 1); const char *str_pos= str + (*pos); @@ -114,7 +124,7 @@ int BLI_str_cursor_step_next_utf8(const char *str, size_t maxlen, short *pos) return FALSE; } -int BLI_str_cursor_step_prev_utf8(const char *str, size_t UNUSED(maxlen), short *pos) +int BLI_str_cursor_step_prev_utf8(const char *str, size_t UNUSED(maxlen), int *pos) { if((*pos) > 0) { const char *str_pos= str + (*pos); @@ -129,7 +139,7 @@ int BLI_str_cursor_step_prev_utf8(const char *str, size_t UNUSED(maxlen), short } void BLI_str_cursor_step_utf8(const char *str, size_t maxlen, - short *pos, strCursorJumpDirection direction, + int *pos, strCursorJumpDirection direction, strCursorJumpType jump) { const short pos_prev= *pos; -- cgit v1.2.3