[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [52833] trunk/blender/source/blender/ blenlib/intern/string_cursor_utf8.c: revert most of r52820 (patch to fix [ #33452]), this caused a regression in text stepping when ctrl is held.
Campbell Barton
ideasman42 at gmail.com
Mon Dec 10 03:06:28 CET 2012
Revision: 52833
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=52833
Author: campbellbarton
Date: 2012-12-10 02:06:26 +0000 (Mon, 10 Dec 2012)
Log Message:
-----------
revert most of r52820 (patch to fix [#33452]), this caused a regression in text stepping when ctrl is held.
This adds back the problem that double-clicking on a single char wont select it. Double click selection may need its own logic.
Revision Links:
--------------
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=52820
Modified Paths:
--------------
trunk/blender/source/blender/blenlib/intern/string_cursor_utf8.c
Modified: trunk/blender/source/blender/blenlib/intern/string_cursor_utf8.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/string_cursor_utf8.c 2012-12-10 01:37:31 UTC (rev 52832)
+++ trunk/blender/source/blender/blenlib/intern/string_cursor_utf8.c 2012-12-10 02:06:26 UTC (rev 52833)
@@ -141,44 +141,49 @@
int *pos, strCursorJumpDirection direction,
strCursorJumpType jump)
{
+ const int pos_prev = *pos;
+
if (direction == STRCUR_DIR_NEXT) {
BLI_str_cursor_step_next_utf8(str, maxlen, pos);
+
if (jump != STRCUR_JUMP_NONE) {
- const strCursorDelimType delim_type = (*pos) < maxlen ? cursor_delim_type(&str[(*pos) - 1]) : STRCUR_DELIM_NONE;
+ const strCursorDelimType delim_type = (*pos) < maxlen ? cursor_delim_type(&str[*pos]) : STRCUR_DELIM_NONE;
/* jump between special characters (/,\,_,-, etc.),
- * look at function test_special_char() for complete
+ * look at function cursor_delim_type() for complete
* list of special character, ctr -> */
- while (TRUE) {
- if ((jump != STRCUR_JUMP_ALL) && (delim_type != cursor_delim_type(&str[*pos]))) {
+ while ((*pos) < maxlen) {
+ if (BLI_str_cursor_step_next_utf8(str, maxlen, pos)) {
+ if ((jump != STRCUR_JUMP_ALL) && (delim_type != cursor_delim_type(&str[*pos])))
break;
}
- else if ((*pos) >= maxlen) {
- break;
+ else {
+ break; /* unlikely but just in case */
}
- BLI_str_cursor_step_next_utf8(str, maxlen, pos);
}
}
}
else if (direction == STRCUR_DIR_PREV) {
BLI_str_cursor_step_prev_utf8(str, maxlen, pos);
+
if (jump != STRCUR_JUMP_NONE) {
- const strCursorDelimType delim_type = (*pos) > 0 ? cursor_delim_type(&str[(*pos)]) : STRCUR_DELIM_NONE;
+ const strCursorDelimType delim_type = (*pos) > 1 ? cursor_delim_type(&str[(*pos) - 1]) : STRCUR_DELIM_NONE;
/* jump between special characters (/,\,_,-, etc.),
- * look at function test_special_char() for complete
+ * look at function cursor_delim_type() for complete
* list of special character, ctr -> */
- while (TRUE) {
- if ((jump != STRCUR_JUMP_ALL) && (delim_type != cursor_delim_type(&str[*pos]))) {
- /* left only: compensate for index/change in direction */
- if (delim_type != STRCUR_DELIM_NONE) {
- BLI_str_cursor_step_next_utf8(str, maxlen, pos);
- }
- break;
+ while ((*pos) > 0) {
+ if (BLI_str_cursor_step_prev_utf8(str, maxlen, pos)) {
+ if ((jump != STRCUR_JUMP_ALL) && (delim_type != cursor_delim_type(&str[*pos])))
+ break;
}
- else if ((*pos) <= 0) {
+ else {
break;
}
- BLI_str_cursor_step_prev_utf8(str, maxlen, pos);
}
+
+ /* left only: compensate for index/change in direction */
+ if (((*pos) != 0) && ABS(pos_prev - (*pos)) >= 1) {
+ BLI_str_cursor_step_next_utf8(str, maxlen, pos);
+ }
}
}
else {
More information about the Bf-blender-cvs
mailing list