Browse code

fix: last line was not being highlighted in some circumstances

Dario Rodriguez authored on 28/12/2020 12:07:38
Showing 1 changed files
... ...
@@ -193,7 +193,7 @@ redata_highlighter_add_or_unadd(redata_t *redata, redata_plugin_t *slot, undo_t
193 193
                 }
194 194
         }
195 195
         /* special case: check if pos is inside last line */
196
-        if(nline>=hl->usedlines && (hl->lines[hl->usedlines-1].pos+hl->lines[hl->usedlines-1].len)>=pos)
196
+        if(nline>=hl->usedlines)
197 197
                 nline=hl->usedlines-1;
198 198
         /* invalidate from this line on */
199 199
         nline=(nline<0)?0:nline;
... ...
@@ -365,7 +365,7 @@ hl_doline(redata_t *redata, highlighter_t *hl, int nline)
365 365
         /* make sure we have previous lines highlighted */
366 366
         for(i=hl->usedlines;i<nline;i++) {
367 367
                 if(hl_doline(redata,hl,i)==-1)
368
-                        return(-1); /* error highlighting line */
368
+                        return(-1); /* error highlighting line */             
369 369
         }
370 370
         hl_invalidatefrom(redata,hl,nline);
371 371
         line=hl->lines+nline;
... ...
@@ -391,7 +391,7 @@ hl_doline(redata_t *redata, highlighter_t *hl, int nline)
391 391
         mlcprevmode=mode_whatever;
392 392
         do {
393 393
                 if(redata_line_rawinfo(redata,realpos+posoffset,&pos,&ptr,&len,NULL)==-1)
394
-                        return(-1); /* couldn't get line data */
394
+                        return(-1); /* couldn't get line data */                
395 395
                 has_nl=((len>0 && ptr[len-1]=='\n')?1:0);
396 396
                 has_next=(len==0)?1:(ptr[len-1]=='\n')?0:1;
397 397
                 /* special case: line with only a newline */
... ...
@@ -788,4 +788,3 @@ hl_addtolinecolor(int *opaque, highlighter_t *hl,linecolor_t *linecolor,int poso
788 788
         return(linecolor);
789 789
 }
790 790
 
791
-