text editor, only draw line highlight when its in the view.
authorCampbell Barton <ideasman42@gmail.com>
Thu, 12 Aug 2010 14:49:08 +0000 (14:49 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Thu, 12 Aug 2010 14:49:08 +0000 (14:49 +0000)
source/blender/editors/space_text/text_draw.c

index 6fbfc463c451a55cd1ee1daf396b51abc3a67180..a8335399a50b939c11d7114f67ada4662300dbfe 100644 (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) {