diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-08-31 09:00:40 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-08-31 09:00:40 +0400 |
commit | fd90e17130e01cb6f71830e325d11c18f74c52a0 (patch) | |
tree | 841f75f9daeee2b894a464ae322e8909206baa0f /source/blender/editors/space_text/text_draw.c | |
parent | d685b18c2f0d7ca0081e6594c2eea77e96a1fe23 (diff) |
text drawing glitche - highlight line was offset slightly from selection.
Diffstat (limited to 'source/blender/editors/space_text/text_draw.c')
-rw-r--r-- | source/blender/editors/space_text/text_draw.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c index 95fd7fce878..e92cab72042 100644 --- a/source/blender/editors/space_text/text_draw.c +++ b/source/blender/editors/space_text/text_draw.c @@ -1133,23 +1133,23 @@ static void draw_cursor(SpaceText *st, ARegion *ar) wrap_offset_in_line(st, ar, text->sell, text->selc, &offl, &offc); - y1 = ar->winy - 2 - (vsell - offl) * lheight; - y2 = y1 - (lheight * visible_lines + TXT_LINE_SPACING); + y1 = ar->winy - (vsell - offl) * lheight; + y2 = y1 - (lheight * visible_lines); } else { - y1 = ar->winy - 2 - vsell * lheight; - y2 = y1 - (lheight + TXT_LINE_SPACING); + y1 = ar->winy - vsell * lheight; + y2 = y1 - (lheight); } if (!(y1 < 0 || y2 > ar->winy)) { /* check we need to draw */ - x1 = st->showlinenrs ? TXT_OFFSET + TEXTXLOC : TXT_OFFSET; + x1 = 0; // st->showlinenrs ? TXT_OFFSET + TEXTXLOC : TXT_OFFSET; x2 = x1 + ar->winx; glColor4ub(255, 255, 255, 32); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_BLEND); - glRecti(x1 - 4, y1, x2, y2 + TXT_LINE_SPACING); + glRecti(x1 - 4, y1, x2, y2); glDisable(GL_BLEND); } } @@ -1317,15 +1317,13 @@ void draw_text_main(SpaceText *st, ARegion *ar) int wraplinecount = 0, wrap_skip = 0; int margin_column_x; - /* dpi controlled line height and font size */ - st->lheight_dpi = (U.widget_unit * st->lheight) / 20; - - if (st->lheight_dpi) st->viewlines = (int)ar->winy / (st->lheight_dpi + TXT_LINE_SPACING); - else st->viewlines = 0; - /* if no text, nothing to do */ if (!text) return; + + /* dpi controlled line height and font size */ + st->lheight_dpi = (U.widget_unit * st->lheight) / 20; + st->viewlines = (st->lheight_dpi) ? (int)ar->winy / (st->lheight_dpi + TXT_LINE_SPACING) : 0; text_update_drawcache(st, ar); |