text editor, only draw line highlight when its in the view.

This commit is contained in:
Campbell Barton
2010-08-12 14:49:08 +00:00
parent e81df3a6fa
commit 47f319eb6e

View File

@@ -1102,17 +1102,19 @@ static void draw_cursor(SpaceText *st, ARegion *ar)
}
if(st->line_hlight) {
/* TODO, dont draw if hidden */
int x1= st->showlinenrs ? TXT_OFFSET + TEXTXLOC : TXT_OFFSET;
int x2= x1 + ar->winx;
y= ar->winy-2 - vsell*st->lheight;
glColor4ub(255, 255, 255, 32);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
glRecti(x1, y, x2, y-st->lheight+1);
glDisable(GL_BLEND);
if(!(y<0 || y > ar->winy)) { /* check we need to draw */
int x1= st->showlinenrs ? TXT_OFFSET + TEXTXLOC : TXT_OFFSET;
int x2= x1 + ar->winx;
y= ar->winy-2 - vsell*st->lheight;
glColor4ub(255, 255, 255, 32);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
glRecti(x1-4, y, x2, y-st->lheight+1);
glDisable(GL_BLEND);
}
}
if(!hidden) {