...
|
...
|
@@ -76,6 +76,7 @@ typedef struct re_t {
|
76
|
76
|
reui_t *ui;
|
77
|
77
|
int viewonly;
|
78
|
78
|
int flag_newfile;
|
|
79
|
+ int showlinenumbers;
|
79
|
80
|
char filename[PATH_MAX];
|
80
|
81
|
int x, y, w, h; // contents rect
|
81
|
82
|
int fontheightpercent;
|
...
|
...
|
@@ -1195,6 +1196,9 @@ fprintf(stderr,"SDL_KEYDOWN: BACKSPACE%s\n",(event==&fakeevent)?" (fake)":"");
|
1195
|
1196
|
re->ignorenkeys++;
|
1196
|
1197
|
} else if(/*re->selactive &&*/ event->key.keysym.sym==SDLK_p && (SDL_GetModState()&KMOD_CTRL)!=0) {
|
1197
|
1198
|
re_addprint(re);
|
|
1199
|
+ } else if(event->key.keysym.sym==SDLK_l && (SDL_GetModState()&KMOD_CTRL)!=0) {
|
|
1200
|
+ re->showlinenumbers=1-re->showlinenumbers;
|
|
1201
|
+ re->contentsdirty=1;
|
1198
|
1202
|
}
|
1199
|
1203
|
return(0);
|
1200
|
1204
|
}
|
...
|
...
|
@@ -2224,7 +2228,7 @@ re_drawcontents(re_t *re, printout_t *printout)
|
2224
|
2228
|
maxcol=re->maxcol;
|
2225
|
2229
|
maxrow=re->maxrow;
|
2226
|
2230
|
showonlyn=0;
|
2227
|
|
- flaglineno=0;
|
|
2231
|
+ flaglineno=(printout==NULL)?re->showlinenumbers:0;
|
2228
|
2232
|
linenosize=linenowidth=0;
|
2229
|
2233
|
if(printout==NULL && re->viewonly==1) {
|
2230
|
2234
|
memset(&fakeprintout,0,sizeof(printout_t));
|
...
|
...
|
@@ -2246,6 +2250,8 @@ re_drawcontents(re_t *re, printout_t *printout)
|
2246
|
2250
|
maxrow=h/ui->fontheight-1;
|
2247
|
2251
|
showonlyn=printout->showonlyn;
|
2248
|
2252
|
flaglineno=1;
|
|
2253
|
+ }
|
|
2254
|
+ if(flaglineno) {
|
2249
|
2255
|
linenosize=6;
|
2250
|
2256
|
linenowidth=linenosize*ui->fontwidth+ui->fontwidth*3/2;
|
2251
|
2257
|
x0+=linenowidth;
|