...
|
...
|
@@ -1698,16 +1698,23 @@ re_processcommand(re_t *re)
|
1698
|
1698
|
}
|
1699
|
1699
|
re->headerdirty=1;
|
1700
|
1700
|
} else if(strcmp(re->command,COMMAND_GOTOLINE)==0) {
|
1701
|
|
- int line;
|
|
1701
|
+ int line,col;
|
1702
|
1702
|
long pos;
|
1703
|
|
- if(re->commandbuf[0]=='+')
|
|
1703
|
+ col=re->curcol;
|
|
1704
|
+ if(re->commandbuf[0]=='+') {
|
1704
|
1705
|
line=re->curline+atoi(re->commandbuf+1);
|
1705
|
|
- else if(re->commandbuf[0]=='-')
|
|
1706
|
+ } else if(re->commandbuf[0]=='-') {
|
1706
|
1707
|
line=re->curline-atoi(re->commandbuf+1);
|
1707
|
|
- else
|
|
1708
|
+ } else {
|
|
1709
|
+ char *ptr;
|
1708
|
1710
|
line=atoi(re->commandbuf)-1;
|
|
1711
|
+ for(ptr=re->commandbuf;*ptr>='0' && *ptr<='9';ptr++)
|
|
1712
|
+ ;
|
|
1713
|
+ if(*ptr==':')
|
|
1714
|
+ col=atoi(ptr+1)-1,col=(col<0)?0:col;
|
|
1715
|
+ }
|
1709
|
1716
|
line=(line<0)?0:line;
|
1710
|
|
- if(redata_linecol2pos(re->data,line,re->curcol,&pos,NULL)==-1) {
|
|
1717
|
+ if(redata_linecol2pos(re->data,line,col,&pos,NULL)==-1) {
|
1711
|
1718
|
re->command=COMMAND_WARNING;
|
1712
|
1719
|
snprintf(re->commandbuf,sizeof(re->commandbuf),"Unknown line");
|
1713
|
1720
|
re->commandbuf[sizeof(re->commandbuf)-1]='\0';
|
...
|
...
|
@@ -1715,6 +1722,7 @@ re_processcommand(re_t *re)
|
1715
|
1722
|
return(-1);
|
1716
|
1723
|
}
|
1717
|
1724
|
re->curline=line;
|
|
1725
|
+ re->curcol=col;
|
1718
|
1726
|
/* position the line in the center of viewport */
|
1719
|
1727
|
re->originline=line-(re->maxrow/2);
|
1720
|
1728
|
re->originline=(re->originline<0)?0:re->originline;
|