[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [33757] trunk/blender/source/blender/ editors/space_text/text_ops.c: Fix for moving caret to the line beginning/ ending when word-wrapping is enabled

Sergey Sharybin g.ulairi at gmail.com
Fri Dec 17 21:24:13 CET 2010


Revision: 33757
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=33757
Author:   nazgul
Date:     2010-12-17 21:24:13 +0100 (Fri, 17 Dec 2010)

Log Message:
-----------
Fix for moving caret to the line beginning/ending when word-wrapping is enabled

Modified Paths:
--------------
    trunk/blender/source/blender/editors/space_text/text_ops.c

Modified: trunk/blender/source/blender/editors/space_text/text_ops.c
===================================================================
--- trunk/blender/source/blender/editors/space_text/text_ops.c	2010-12-17 20:13:54 UTC (rev 33756)
+++ trunk/blender/source/blender/editors/space_text/text_ops.c	2010-12-17 20:24:13 UTC (rev 33757)
@@ -1541,6 +1541,7 @@
 				*charp= endj;
 
 				if(j>=oldc) {
+					if(ch=='\0') *charp= start;
 					loop= 0;
 					break;
 				}
@@ -1549,10 +1550,11 @@
 
 				start= end;
 				end += max;
-				chop= 0;
+				chop= 1;
 			}
 			else if(ch==' ' || ch=='-' || ch=='\0') {
 				if(j>=oldc) {
+					*charp= start;
 					loop= 0;
 					break;
 				}
@@ -1587,10 +1589,11 @@
 
 	max= wrap_width(st, ar);
 
-	start= chars= endj= 0;
+	start= chars= 0;
 	end= max;
 	chop= loop= 1;
 	*charp= 0;
+	endj= max-1;
 
 	for(i=0, j=0; loop; j++) {
 		/* Mimic replacement of tabs */
@@ -1604,16 +1607,17 @@
 		while(chars--) {
 			if(i-start>=max) {
 				if(endj>=oldc) {
-					*charp= endj;
+					if(ch=='\0') *charp= (*linep)->len;
+					else *charp= endj;
 					loop= 0;
 					break;
 				}
 
-				if(chop) endj= j;
+				if(chop) endj= j-1;
 
 				start= end;
 				end += max;
-				chop= 0;
+				chop= 1;
 			} else if(ch=='\0') {
 				*charp= (*linep)->len;
 				loop= 0;





More information about the Bf-blender-cvs mailing list