aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRob Pike <robpike@gmail.com>2013-10-22 16:47:48 -0700
committerRob Pike <robpike@gmail.com>2013-10-22 16:47:48 -0700
commit5a69e405fcae96b476cdd7a0767e87b94c0b7266 (patch)
tree2ae94b206607d5acf664580cca5d95360e522e3b /src
parent075c3bdc54b5201350b88b53d5330cc6a9cc499d (diff)
downloadplan9port-5a69e405fcae96b476cdd7a0767e87b94c0b7266.tar.gz
plan9port-5a69e405fcae96b476cdd7a0767e87b94c0b7266.tar.bz2
plan9port-5a69e405fcae96b476cdd7a0767e87b94c0b7266.zip
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
Diffstat (limited to 'src')
-rw-r--r--src/cmd/acme/text.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/cmd/acme/text.c b/src/cmd/acme/text.c
index 3c08cd64..5a491b1e 100644
--- a/src/cmd/acme/text.c
+++ b/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 && (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)