[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [46116] trunk/blender/source/blender: Word selection in the Text Editor:

Sv. Lockal lockalsash at gmail.com
Mon Apr 30 15:14:16 CEST 2012


Revision: 46116
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=46116
Author:   lockal
Date:     2012-04-30 13:14:15 +0000 (Mon, 30 Apr 2012)
Log Message:
-----------
Word selection in the Text Editor:

* Fix word selection for words with multibyte characters. No need to call txt_move_left() or txt_move_right(), because these functions work with symbols, not bytes
* Word selection now treats tabs the same way as spaces. Also useful for words with multibyte characters

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/text.c
    trunk/blender/source/blender/blenlib/intern/string_cursor_utf8.c

Modified: trunk/blender/source/blender/blenkernel/intern/text.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/text.c	2012-04-30 12:50:58 UTC (rev 46115)
+++ trunk/blender/source/blender/blenkernel/intern/text.c	2012-04-30 13:14:15 UTC (rev 46116)
@@ -957,9 +957,8 @@
 void txt_jump_left(Text *text, short sel)
 {
 	TextLine **linep, *oldl;
-	int *charp, oldc, oldflags, i;
+	int *charp, oldc, oldflags;
 	unsigned char oldu;
-	int pos;
 
 	if (!text) return;
 	if (sel) txt_curs_sel(text, &linep, &charp);
@@ -974,13 +973,9 @@
 	oldu= undoing;
 	undoing= 1; /* Don't push individual moves to undo stack */
 
-	pos = *charp;
 	BLI_str_cursor_step_utf8((*linep)->line, (*linep)->len,
-	                         &pos, STRCUR_DIR_PREV,
+                             charp, STRCUR_DIR_PREV,
 	                         STRCUR_JUMP_DELIM);
-	for (i = *charp; i > pos; i--) {
-		txt_move_left(text, sel);
-	}
 
 	text->flags = oldflags;
 
@@ -991,9 +986,8 @@
 void txt_jump_right(Text *text, short sel)
 {
 	TextLine **linep, *oldl;
-	int *charp, oldc, oldflags, i;
+	int *charp, oldc, oldflags;
 	unsigned char oldu;
-	int pos;
 
 	if (!text) return;
 	if (sel) txt_curs_sel(text, &linep, &charp);
@@ -1008,13 +1002,9 @@
 	oldu= undoing;
 	undoing= 1; /* Don't push individual moves to undo stack */
 
-	pos = *charp;
 	BLI_str_cursor_step_utf8((*linep)->line, (*linep)->len,
-	                         &pos, STRCUR_DIR_NEXT,
+                             charp, STRCUR_DIR_NEXT,
 	                         STRCUR_JUMP_DELIM);
-	for (i = *charp; i < pos; i++) {
-		txt_move_right(text, sel);
-	}
 
 	text->flags = oldflags;
 

Modified: trunk/blender/source/blender/blenlib/intern/string_cursor_utf8.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/string_cursor_utf8.c	2012-04-30 12:50:58 UTC (rev 46115)
+++ trunk/blender/source/blender/blenlib/intern/string_cursor_utf8.c	2012-04-30 13:14:15 UTC (rev 46116)
@@ -93,6 +93,7 @@
 			return STRCUR_DELIM_QUOTE;
 
 		case ' ':
+		case '\t':
 			return STRCUR_DELIM_WHITESPACE;
 
 		case '\\':




More information about the Bf-blender-cvs mailing list