Skip to content

Commit

Permalink
acme: scroll a directory window when navigating if:
Browse files Browse the repository at this point in the history
        - the cursor is on the last line
        - the navigation would put the cursor over the tag of the following text

R=rsc
CC=smckean83
https://codereview.appspot.com/15280045
  • Loading branch information
robpike committed Oct 22, 2013
1 parent 9682361 commit df613e3
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 4 deletions.
13 changes: 11 additions & 2 deletions plumb/basic
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,18 @@ arg isfile $0
plumb to openoffice
plumb start openoffice $file

# existing files tagged by line number:columnumber or linenumber.columnumber, go to editor
# existing files tagged by line number:columnumber or linenumber.columnumber, twice, go to editor
type is text
data matches '([.a-zA-Z¡-￿0-9_/\-]*[a-zA-Z¡-￿0-9_/\-])'$twocolonaddr'
data matches '([.a-zA-Z¡-￿0-9_/\-]*[a-zA-Z¡-￿0-9_/\-])':$twocolonaddr,$twocolonaddr
arg isfile $1
data set $file
attr add addr=$2-#1+#$3,$4-#1+#$5
plumb to edit
plumb client $editor

# existing files tagged by line number:columnumber or linenumber.columnumber, twice, go to editor
type is text
data matches '([.a-zA-Z¡-￿0-9_/\-]*[a-zA-Z¡-￿0-9_/\-])':$twocolonaddr
arg isfile $1
data set $file
attr add addr=$2-#1+#$3
Expand Down
2 changes: 1 addition & 1 deletion plumb/fileaddr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
addrelem='((#?[0-9]+)|(/[A-Za-z0-9_\^]+/?)|[.$])'
addr=:($addrelem([,;+\-]$addrelem)*)

twocolonaddr = :([0-9]+)[:.]([0-9]+)
twocolonaddr = ([0-9]+)[:.]([0-9]+)
18 changes: 17 additions & 1 deletion src/cmd/acme/text.c
Original file line number Diff line number Diff line change
Expand Up @@ -808,6 +808,7 @@ texttype(Text *t, Rune r)
switch(r){
case 0x06: /* ^F: complete */
case Kins:
typecommit(t);
rp = textcomplete(t);
if(rp == nil)
return;
Expand Down Expand Up @@ -1079,6 +1080,8 @@ textshow(Text *t, uint q0, uint q1, int doselect)
{
int qe;
int nl;
int tsd;
int nc;
uint q;

if(t->what != Body){
Expand All @@ -1091,7 +1094,20 @@ textshow(Text *t, uint q0, uint q1, int doselect)
if(doselect)
textsetselect(t, q0, q1);
qe = t->org+t->fr.nchars;
if(t->org<=q0 && (q0<qe || (q0==qe && qe==t->file->b.nc+t->ncache)))
tsd = FALSE; /* do we call textscrdraw? */
nc = t->file->b.nc+t->ncache;
if(t->org <= q0){
if(nc==0 || q0<qe)
tsd = TRUE;
else if(q0==qe && qe==nc){
if(textreadc(t, nc-1) == '\n'){
if(t->fr.nlines<t->fr.maxlines)
tsd = TRUE;
}else
tsd = TRUE;
}
}
if(tsd)
textscrdraw(t);
else{
if(t->w->nopen[QWevent] > 0)
Expand Down

0 comments on commit df613e3

Please sign in to comment.