forked from bartvdbraak/blender
text drawing glitche - highlight line was offset slightly from selection.
This commit is contained in:
parent
d685b18c2f
commit
fd90e17130
@ -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);
|
||||
|
||||
|
@ -54,7 +54,7 @@ void text_scroll_to_cursor(struct SpaceText *st, struct ScrArea *sa);
|
||||
void text_update_cursor_moved(struct bContext *C);
|
||||
|
||||
/* TXT_OFFSET used to be 35 when the scrollbar was on the left... */
|
||||
#define TXT_OFFSET ((int)(0.75f * U.widget_unit))
|
||||
#define TXT_OFFSET ((int)(0.2f * U.widget_unit))
|
||||
#define TXT_SCROLL_WIDTH U.widget_unit
|
||||
#define TXT_SCROLL_SPACE ((int)(0.1f * U.widget_unit))
|
||||
#define TXT_LINE_SPACING ((int)(0.2f * U.widget_unit)) /* space between lines */
|
||||
|
Loading…
Reference in New Issue
Block a user