[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [33755] trunk/blender/source/blender/ editors/space_text/text_ops.c: Fix #25263: Text cursor click point is random.
Sergey Sharybin
g.ulairi at gmail.com
Fri Dec 17 20:58:02 CET 2010
Revision: 33755
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=33755
Author: nazgul
Date: 2010-12-17 20:58:02 +0100 (Fri, 17 Dec 2010)
Log Message:
-----------
Fix #25263: Text cursor click point is random.
- Fixed some wierd cursor placements when clicking in special text position
(mostly when line segments had null-terminator at the max allowed position)
- Also subtract top padding, so centering is looks a bit better
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 19:05:34 UTC (rev 33754)
+++ trunk/blender/source/blender/editors/space_text/text_ops.c 2010-12-17 19:58:02 UTC (rev 33755)
@@ -2220,14 +2220,14 @@
Text *text= st->text;
TextLine **linep;
int *charp;
- int w, tabs;
+ int w;
text_update_character_width(st);
if(sel) { linep= &text->sell; charp= &text->selc; }
else { linep= &text->curl; charp= &text->curc; }
- y= (ar->winy - y)/st->lheight;
+ y= (ar->winy - 2 - y)/st->lheight;
if(st->showlinenrs)
x-= TXT_OFFSET+TEXTXLOC;
@@ -2267,14 +2267,12 @@
chars= 0;
curs= 0;
endj= 0;
- tabs= 0;
for(i=0, j=0; loop; j++) {
/* Mimic replacement of tabs */
ch= (*linep)->line[j];
if(ch=='\t') {
chars= st->tabnumber-i%st->tabnumber;
- tabs+= chars-1;
ch= ' ';
}
else
@@ -2302,7 +2300,7 @@
if(found) {
/* exact cursor position was found, check if it's */
/* still on needed line (hasn't been wrapped) */
- if(*charp>endj && !chop) (*charp)= endj;
+ if(*charp>endj && !chop && ch!='\0') (*charp)= endj;
loop= 0;
break;
}
@@ -2311,7 +2309,7 @@
start= end;
end += max;
- if(start-tabs<(*linep)->len)
+ if(j<(*linep)->len)
y--;
chop= 1;
@@ -2340,13 +2338,13 @@
}
if(ch=='\0') break;
}
- if(!loop || y<0) break;
+ if(!loop || found) break;
if(!(*linep)->next) {
*charp= (*linep)->len;
break;
}
-
+
/* On correct line but didn't meet cursor, must be at end */
if(y==0) {
*charp= (*linep)->len;
More information about the Bf-blender-cvs
mailing list