commit 5a69e405fcae96b476cdd7a0767e87b94c0b7266 from: Rob Pike date: Tue Oct 22 23:47:48 2013 UTC acme: scroll a directory window when navigating if: - 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 commit - 075c3bdc54b5201350b88b53d5330cc6a9cc499d commit + 5a69e405fcae96b476cdd7a0767e87b94c0b7266 blob - 5ab07ec409198536bf6dbe87016249a104bf28b3 blob + f728132fdcbacafd377915bfa63da384105911a4 --- plumb/basic +++ plumb/basic @@ -59,11 +59,20 @@ 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 plumb to edit plumb client $editor blob - cd2f120f7b1d86f43606b0fcd75da83084231791 blob + f5595bd43f5fb75781e1159d333390d36a5b17fc --- plumb/fileaddr +++ plumb/fileaddr @@ -1,4 +1,4 @@ addrelem='((#?[0-9]+)|(/[A-Za-z0-9_\^]+/?)|[.$])' addr=:($addrelem([,;+\-]$addrelem)*) -twocolonaddr = :([0-9]+)[:.]([0-9]+) +twocolonaddr = ([0-9]+)[:.]([0-9]+) blob - 3c08cd64a34d3a5848497e034c9ecd2ebc82029c blob + 5a491b1e77fc2236251106d45cf60fa4c4343471 --- src/cmd/acme/text.c +++ src/cmd/acme/text.c @@ -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; @@ -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){ @@ -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 && (q0file->b.nc+t->ncache))) + tsd = FALSE; /* do we call textscrdraw? */ + nc = t->file->b.nc+t->ncache; + if(t->org <= q0){ + if(nc==0 || q0fr.nlinesfr.maxlines) + tsd = TRUE; + }else + tsd = TRUE; + } + } + if(tsd) textscrdraw(t); else{ if(t->w->nopen[QWevent] > 0)