...
|
...
|
@@ -566,6 +566,7 @@ fprintf(stderr,"SDL_TEXTINPUT: Insering newline\n");
|
566
|
566
|
re->curcol+=redata_generic_utf8len(event->text.text,len);
|
567
|
567
|
}
|
568
|
568
|
redata_undo_groupcommit(re->data,NULL);
|
|
569
|
+ re_fixorigin(re);
|
569
|
570
|
re->headerdirty=1;
|
570
|
571
|
re->contentsdirty=1;
|
571
|
572
|
}
|
...
|
...
|
@@ -582,7 +583,9 @@ fprintf(stderr,"SDL_TEXTEDITING: composition:\"%s\" start:%i len:%i\n",event->ed
|
582
|
583
|
#if 0
|
583
|
584
|
fprintf(stderr,"SDL_KEYDOWN: sym:%i\n",event->key.keysym.sym);
|
584
|
585
|
#endif
|
585
|
|
- if((SDL_GetModState()&KMOD_ALT)!=0 && re->selactive && (event->key.keysym.sym==SDLK_LEFT || event->key.keysym.sym==SDLK_RIGHT)) {
|
|
586
|
+ if(event->key.keysym.sym==SDLK_ESCAPE) {
|
|
587
|
+ re->headerdirty=1;
|
|
588
|
+ } else if((SDL_GetModState()&KMOD_ALT)!=0 && re->selactive && (event->key.keysym.sym==SDLK_LEFT || event->key.keysym.sym==SDLK_RIGHT)) {
|
586
|
589
|
int l;
|
587
|
590
|
int is_del;
|
588
|
591
|
int tolinefix;
|
...
|
...
|
@@ -742,6 +745,7 @@ fprintf(stderr,"SDL_KEYDOWN: BACKSPACE%s\n",(event==&fakeevent)?" (fake)":"");
|
742
|
745
|
re->headerdirty=1;
|
743
|
746
|
re->contentsdirty=1;
|
744
|
747
|
} else if(event->key.keysym.sym==SDLK_PLUS && (SDL_GetModState()&KMOD_CTRL)!=0) {
|
|
748
|
+#warning XXX TODO: Control+shift+'+'/'-' iterates between the color permutations of the current theme in rgb, 6 in total (Control+shift+'0' resets to the default permutation)
|
745
|
749
|
re_changefontsize(re, 1);
|
746
|
750
|
re->ignorenkeys++;
|
747
|
751
|
} else if(event->key.keysym.sym==SDLK_MINUS && (SDL_GetModState()&KMOD_CTRL)!=0) {
|
...
|
...
|
@@ -992,6 +996,7 @@ re_processcommand(re_t *re)
|
992
|
996
|
re->curline=line;
|
993
|
997
|
/* position the line in the center of viewport */
|
994
|
998
|
re->originline=line-(re->maxrow/2);
|
|
999
|
+ re->originline=(re->originline<0)?0:re->originline;
|
995
|
1000
|
re->headerdirty=1;
|
996
|
1001
|
re->contentsdirty=1;
|
997
|
1002
|
} else if(strcmp(re->command,COMMAND_SEARCHFORWARD)==0) {
|
...
|
...
|
@@ -1670,13 +1675,7 @@ re_drawcontents(re_t *re)
|
1670
|
1675
|
return(-1);
|
1671
|
1676
|
if(redata_linecol2pos(re->data,re->curline,re->curcol,&cursorpos,NULL)!=0)
|
1672
|
1677
|
return(0); /* error obtaining position */
|
1673
|
|
-#if 0
|
1674
|
|
-fprintf(stderr,"re_drawcontents: pre reuifill1\n");
|
1675
|
|
-#endif
|
1676
|
1678
|
reui_fill(re->ui,re->x,re->y,re->w,re->h,"\xdf\xdf\xdf\xff");
|
1677
|
|
-#if 0
|
1678
|
|
-fprintf(stderr,"re_drawcontents: post reuifill1\n");
|
1679
|
|
-#endif
|
1680
|
1679
|
row=re->curline-re->originline;
|
1681
|
1680
|
pos=cursorpos;
|
1682
|
1681
|
while(row>0 && pos>0) {
|
...
|
...
|
@@ -1687,20 +1686,11 @@ fprintf(stderr,"re_drawcontents: post reuifill1\n");
|
1687
|
1686
|
row--;
|
1688
|
1687
|
}
|
1689
|
1688
|
/* highlight current line */
|
1690
|
|
-#if 0
|
1691
|
|
-fprintf(stderr,"re_drawcontents: pre reuifill2\n");
|
1692
|
|
-#endif
|
1693
|
1689
|
reui_fill(re->ui,re->x,re->y+(re->curline-re->originline)*re->ui->fontheight,re->w,re->ui->fontheight+1,"\xef\xef\xef\xff");
|
1694
|
|
-#if 0
|
1695
|
|
-fprintf(stderr,"re_drawcontents: post reuifill2\n");
|
1696
|
|
-#endif
|
1697
|
1690
|
/* highlight the selection */
|
1698
|
1691
|
if(re->selactive) {
|
1699
|
1692
|
const char *selcolor;
|
1700
|
1693
|
tmprow=row;
|
1701
|
|
-#if 0
|
1702
|
|
-fprintf(stderr,"re_drawcontents: reuifill3: ");
|
1703
|
|
-#endif
|
1704
|
1694
|
for(y=re->y;y<(re->y+re->h);y+=re->ui->fontheight,row++) {
|
1705
|
1695
|
selcolor=(row==(re->curline-re->originline))?selcolorcurline:selcolornormal;
|
1706
|
1696
|
if((re->originline+row)==re->sellinefrom && (re->originline+row)==re->sellineto) {
|
...
|
...
|
@@ -1711,13 +1701,7 @@ fprintf(stderr,"re_drawcontents: reuifill3: ");
|
1711
|
1701
|
if(x1<(re->x+re->w))
|
1712
|
1702
|
reui_fill(re->ui,x1,re->y+row*re->ui->fontheight,re->w-x1,re->ui->fontheight+1,selcolor);
|
1713
|
1703
|
} else if((re->originline+row)>re->sellinefrom && (re->originline+row)<re->sellineto) {
|
1714
|
|
-#if 0
|
1715
|
|
-fprintf(stderr,"{(ui,%i,%i,%i,%i,#%02X%02X%02X%02X)",re->x,re->y+row*re->ui->fontheight,re->w,re->ui->fontheight+1,((unsigned char *)selcolor)[0],((unsigned char *)selcolor)[1],((unsigned char *)selcolor)[2],((unsigned char *)selcolor)[3]);
|
1716
|
|
-#endif
|
1717
|
1704
|
reui_fill(re->ui,re->x,re->y+row*re->ui->fontheight,re->w,re->ui->fontheight+1,selcolor);
|
1718
|
|
-#if 0
|
1719
|
|
-fprintf(stderr,"}");
|
1720
|
|
-#endif
|
1721
|
1705
|
} else if((re->originline+row)==re->sellineto) {
|
1722
|
1706
|
int x2;
|
1723
|
1707
|
x2=re->x+(re->selcolto-re->origincol)*re->ui->fontwidth;
|
...
|
...
|
@@ -1727,9 +1711,6 @@ fprintf(stderr,"}");
|
1727
|
1711
|
|
1728
|
1712
|
}
|
1729
|
1713
|
row=tmprow;
|
1730
|
|
-#if 0
|
1731
|
|
-fprintf(stderr,"\n");
|
1732
|
|
-#endif
|
1733
|
1714
|
}
|
1734
|
1715
|
/* draw the lines */
|
1735
|
1716
|
drawn_cursor=0;
|