[Bf-blender-cvs] [5687cac] temp-text_editor_cursor_api: forgot to handle tabs in lines properly as well
Martin Felke
noreply at git.blender.org
Tue Dec 30 13:44:49 CET 2014
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);
}
More information about the Bf-blender-cvs
mailing list