...
|
...
|
@@ -179,7 +179,7 @@ redata_highlighter_add_or_unadd(redata_t *redata, redata_plugin_t *slot, undo_t
|
179
|
179
|
if(redata==NULL || slot==NULL || hl==NULL || undo==NULL || stack==NULL || slot->active==0)
|
180
|
180
|
return(-1); /* sanity check failed */
|
181
|
181
|
if(hl->usedlines==0) {
|
182
|
|
-#if 1
|
|
182
|
+#if 0
|
183
|
183
|
fprintf(stderr,"INVALIDATING USEDLINELINES==0 (nothing to do)\n");
|
184
|
184
|
#endif
|
185
|
185
|
return(0); /* nothing to do */
|
...
|
...
|
@@ -203,7 +203,7 @@ fprintf(stderr,"INVALIDATING USEDLINELINES==0 (nothing to do)\n");
|
203
|
203
|
/* invalidate from this line on */
|
204
|
204
|
nline=(nline<0)?0:nline;
|
205
|
205
|
hl_invalidatefrom(redata,hl,nline);
|
206
|
|
-#if 1
|
|
206
|
+#if 0
|
207
|
207
|
fprintf(stderr,"INVALIDATING LINE %i\n",nline);
|
208
|
208
|
#endif
|
209
|
209
|
return(0);
|
...
|
...
|
@@ -404,25 +404,67 @@ fprintf(stderr,"Doing line %i pos:%li\n",nline,line->pos);
|
404
|
404
|
hl->useddirectivebuf=0;
|
405
|
405
|
mlcprevmode=mode_whatever;
|
406
|
406
|
do {
|
407
|
|
- if(redata_line_rawinfo(redata,realpos+posoffset,&pos,&ptr,&len,NULL)==-1)
|
|
407
|
+ if(redata_line_rawinfo(redata,realpos+posoffset,&pos,&ptr,&len,NULL)==-1) {
|
|
408
|
+#if 0
|
|
409
|
+fprintf(stderr,"nline:%i ERROR: couldn't get lineinfo for realpos:%li posoffset:%i realpos+posoffset:%li redataused:%li\n",
|
|
410
|
+nline,realpos,posoffset,realpos+posoffset,redata_getused(redata));
|
|
411
|
+#endif
|
408
|
412
|
return(-1); /* couldn't get line data */
|
|
413
|
+ }
|
409
|
414
|
has_nl=((len>0 && ptr[len-1]=='\n')?1:0);
|
410
|
415
|
has_next=(len==0)?1:(ptr[len-1]=='\n')?0:1;
|
411
|
416
|
/* special case: line with only a newline */
|
412
|
417
|
if(posoffset==0 && has_nl==1 && len==1) {
|
413
|
418
|
/* delete the existing linecolor and break */
|
414
|
419
|
line->len=0;
|
|
420
|
+#if 0
|
|
421
|
+fprintf(stderr,"nline:%i detected blank line, exiting\n",nline);
|
|
422
|
+#endif
|
415
|
423
|
break;
|
416
|
424
|
}
|
417
|
425
|
/* iterate */
|
418
|
426
|
#if 0
|
419
|
|
-fprintf(stderr,"Line %i chunk at posoffset %i\n",nline, posoffset);
|
|
427
|
+#define HDEBUGLINE 775
|
|
428
|
+if(nline==HDEBUGLINE || nline==(HDEBUGLINE+1)) {
|
|
429
|
+fprintf(stderr,"Line %i chunk at posoffset:%i (realpos:%li)\n",nline, posoffset,realpos);
|
|
430
|
+fprintf(stderr,"NEW RAWINFO, nline:%i len:%i has_nl:%i has_next:%i mode:%s(%i) mlcprevmode:%s(%i)\n",nline,len,has_nl,has_next,
|
|
431
|
+mode==mode_whatever?"whatever":
|
|
432
|
+mode==mode_in_multilinecomment?"mlc":
|
|
433
|
+mode==mode_in_linecomment?"comment":
|
|
434
|
+mode==mode_in_directive?"directive":
|
|
435
|
+mode==mode_in_string?"string":
|
|
436
|
+mode==mode_in_directivestring?"directivestring":"unknown",
|
|
437
|
+mode,
|
|
438
|
+mlcprevmode==mode_whatever?"whatever":
|
|
439
|
+mlcprevmode==mode_in_multilinecomment?"mlc":
|
|
440
|
+mlcprevmode==mode_in_linecomment?"comment":
|
|
441
|
+mlcprevmode==mode_in_directive?"directive":
|
|
442
|
+mlcprevmode==mode_in_string?"string":
|
|
443
|
+mlcprevmode==mode_in_directivestring?"directivestring":"unknown",
|
|
444
|
+mlcprevmode
|
|
445
|
+);
|
|
446
|
+}
|
420
|
447
|
#endif
|
421
|
|
-#warning FALTA PONER DE UN COLOR DIFERENTE lo de <nombre.h> de los #include (pero no de los #define!)
|
422
|
448
|
for(i=0;i<(len-has_nl);prev_char=(ptr[i]&prev_char_mask),prev_char_mask=0xff,i++) {
|
423
|
449
|
#if 0
|
424
|
|
-if(nline==1)
|
425
|
|
- fprintf(stderr,"ptr[%i]='%c' prev_char='%s%c'\n",i,ptr[i],(prev_char=='\0')?"\\":"",(prev_char=='\0')?'0':prev_char);
|
|
450
|
+if(nline==HDEBUGLINE || nline==(HDEBUGLINE+1)) {
|
|
451
|
+fprintf(stderr,"ptr[%i]='%c' prev_char='%s%c' mode=%s(%i) mlcprevmode=%s(%i)\n",i,ptr[i],(prev_char=='\0')?"\\":"",(prev_char=='\0')?'0':prev_char,
|
|
452
|
+mode==mode_whatever?"whatever":
|
|
453
|
+mode==mode_in_multilinecomment?"mlc":
|
|
454
|
+mode==mode_in_linecomment?"comment":
|
|
455
|
+mode==mode_in_directive?"directive":
|
|
456
|
+mode==mode_in_string?"string":
|
|
457
|
+mode==mode_in_directivestring?"directivestring":"unknown",
|
|
458
|
+mode,
|
|
459
|
+mlcprevmode==mode_whatever?"whatever":
|
|
460
|
+mlcprevmode==mode_in_multilinecomment?"mlc":
|
|
461
|
+mlcprevmode==mode_in_linecomment?"comment":
|
|
462
|
+mlcprevmode==mode_in_directive?"directive":
|
|
463
|
+mlcprevmode==mode_in_string?"string":
|
|
464
|
+mlcprevmode==mode_in_directivestring?"directivestring":"unknown",
|
|
465
|
+mlcprevmode
|
|
466
|
+);
|
|
467
|
+}
|
426
|
468
|
#endif
|
427
|
469
|
/* special case: keyword ends in a change of mode */
|
428
|
470
|
if(mode!=mode_whatever && hl->usedkeywordbuf>0) {
|
...
|
...
|
@@ -595,7 +637,7 @@ if(nline==1)
|
595
|
637
|
}
|
596
|
638
|
}
|
597
|
639
|
posoffset+=len;
|
598
|
|
- } while(has_next!=0 && (pos+posoffset)<redataused);
|
|
640
|
+ } while(has_next!=0 && (realpos+posoffset)<redataused);
|
599
|
641
|
/* special case: keyword ends at end-of-line */
|
600
|
642
|
if(mode==mode_whatever && hl->usedkeywordbuf>0 && hl_searchlist(keywords,nkeywords,hl->keywordbuf,hl->usedkeywordbuf,NULL)==0) {
|
601
|
643
|
linecolor=hl_addtolinecolor(&opaque,hl,linecolor,hl->keywordbufstart,color_keyword);
|
...
|
...
|
@@ -752,8 +794,8 @@ hl_addtolinecolor(int *opaque, highlighter_t *hl,linecolor_t *linecolor,int poso
|
752
|
794
|
if(opaque==NULL || *opaque<0 || hl==NULL || (posoff!=0 && linecolor==NULL) || color<0 || posoff<0)
|
753
|
795
|
return(NULL); /* sanity check failed */
|
754
|
796
|
#if 0
|
755
|
|
-#define DEBUGLINE 12
|
756
|
|
-if(hl->usedlines==DEBUGLINE) {
|
|
797
|
+#define DEBUGLINE 775
|
|
798
|
+if(hl->usedlines==DEBUGLINE || hl->usedlines==(DEBUGLINE+1)) {
|
757
|
799
|
int i,k;
|
758
|
800
|
int l=hl->lines[hl->usedlines].len;
|
759
|
801
|
linecolor_t *lc=(linecolor_t *) (hl->buf+hl->lines[hl->usedlines].off);
|
...
|
...
|
@@ -797,7 +839,7 @@ hl->useddirectivebuf,
|
797
|
839
|
linecolor->color=color;
|
798
|
840
|
*opaque=1;
|
799
|
841
|
#if 0
|
800
|
|
-if(hl->usedlines==DEBUGLINE) {
|
|
842
|
+if(hl->usedlines==DEBUGLINE || hl->usedlines==(DEBUGLINE+1)) {
|
801
|
843
|
int i,k;
|
802
|
844
|
int l=hl->lines[hl->usedlines].len;
|
803
|
845
|
linecolor_t *lc=(linecolor_t *) (hl->buf+hl->lines[hl->usedlines].off);
|
...
|
...
|
@@ -836,7 +878,7 @@ fprintf(stderr,"\"\n");
|
836
|
878
|
linecolor[-1].len+=added;
|
837
|
879
|
*opaque+=added;
|
838
|
880
|
#if 0
|
839
|
|
-if(hl->usedlines==DEBUGLINE) {
|
|
881
|
+if(hl->usedlines==DEBUGLINE || hl->usedlines==(DEBUGLINE+1)) {
|
840
|
882
|
int i,k;
|
841
|
883
|
int l=hl->lines[hl->usedlines].len;
|
842
|
884
|
linecolor_t *lc=(linecolor_t *) (hl->buf+hl->lines[hl->usedlines].off);
|
...
|
...
|
@@ -857,7 +899,7 @@ fprintf(stderr,"\"\n");
|
857
|
899
|
line->len+=sizeof(linecolor_t);
|
858
|
900
|
hl->usedbuf+=sizeof(linecolor_t);
|
859
|
901
|
#if 0
|
860
|
|
-if(hl->usedlines==DEBUGLINE) {
|
|
902
|
+if(hl->usedlines==DEBUGLINE || hl->usedlines==(DEBUGLINE+1)) {
|
861
|
903
|
int i,k;
|
862
|
904
|
int l=hl->lines[hl->usedlines].len;
|
863
|
905
|
linecolor_t *lc=(linecolor_t *) (hl->buf+hl->lines[hl->usedlines].off);
|