Commit: 5687caca4156ec897329aa7b4babe12d7c938cf6
Author: Martin Felke
Date:   Tue Dec 30 13:39:52 2014 +0100
Branches: temp-text_editor_cursor_api
https://developer.blender.org/rB5687caca4156ec897329aa7b4babe12d7c938cf6

forgot to handle tabs in lines properly as well

===================================================================

M       source/blender/editors/space_text/text_draw.c

===================================================================

diff --git a/source/blender/editors/space_text/text_draw.c 
b/source/blender/editors/space_text/text_draw.c
index d9d46de..e578e8a 100644
--- a/source/blender/editors/space_text/text_draw.c
+++ b/source/blender/editors/space_text/text_draw.c
@@ -1568,12 +1568,14 @@ bool ED_text_region_location_from_cursor(SpaceText *st, 
ARegion* ar, const int c
        else {
                int offl = 0, offc = 0;
                int linenr_offset = st->showlinenrs ? TXT_OFFSET + TEXTXLOC : 
TXT_OFFSET;
+               /* dont forget to handle tabs as well !*/
+               int char_pos = text_get_char_pos(st, line->line, cursor_co[1]);
 
                if (st->wordwrap) {
                        wrap_offset(st, ar, line, cursor_co[1], &offl, &offc);
                }
 
-               r_pixel_co[0] = (cursor_co[1] + offc - st->left) * st->cwidth + 
linenr_offset;
+               r_pixel_co[0] = (char_pos + offc - st->left) * st->cwidth + 
linenr_offset;
                r_pixel_co[1] = (cursor_co[0] + offl - st->top) * 
(st->lheight_dpi + TXT_LINE_SPACING);
                r_pixel_co[1] = ar->winy - (r_pixel_co[1] + TXT_OFFSET);
        }

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to