aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/samterm
diff options
context:
space:
mode:
authorrsc <devnull@localhost>2007-05-10 19:08:47 +0000
committerrsc <devnull@localhost>2007-05-10 19:08:47 +0000
commit7a3533513e6f401bf62d94d4577922771090ffb4 (patch)
treed8532895cbc2129de29f7ee161697a61a91ddaf1 /src/cmd/samterm
parent813751d7549110861174912c9c12ea01dae0d084 (diff)
downloadplan9port-7a3533513e6f401bf62d94d4577922771090ffb4.tar.gz
plan9port-7a3533513e6f401bf62d94d4577922771090ffb4.tar.bz2
plan9port-7a3533513e6f401bf62d94d4577922771090ffb4.zip
manage off-screen tick better
Diffstat (limited to 'src/cmd/samterm')
-rw-r--r--src/cmd/samterm/flayer.c24
-rw-r--r--src/cmd/samterm/flayer.h2
2 files changed, 18 insertions, 8 deletions
diff --git a/src/cmd/samterm/flayer.c b/src/cmd/samterm/flayer.c
index 729b72cf..6497eea6 100644
--- a/src/cmd/samterm/flayer.c
+++ b/src/cmd/samterm/flayer.c
@@ -274,6 +274,7 @@ void
flsetselect(Flayer *l, long p0, long p1)
{
ulong fp0, fp1;
+ int ticked;
l->click = 0;
if(l->visible==None || !flprepare(l)){
@@ -281,9 +282,12 @@ flsetselect(Flayer *l, long p0, long p1)
return;
}
l->p0 = p0, l->p1 = p1;
- flfp0p1(l, &fp0, &fp1);
- if(fp0==l->f.p0 && fp1==l->f.p1)
+ flfp0p1(l, &fp0, &fp1, &ticked);
+ if(fp0==l->f.p0 && fp1==l->f.p1){
+ if(l->f.ticked != ticked)
+ frdrawseltick(&l->f, frptofchar(&l->f, fp0), fp0, fp1, 1, ticked);
return;
+ }
if(fp1<=l->f.p0 || fp0>=l->f.p1 || l->f.p0==l->f.p1 || fp0==fp1){
/* no overlap or trivial repainting */
@@ -315,18 +319,23 @@ flsetselect(Flayer *l, long p0, long p1)
}
void
-flfp0p1(Flayer *l, ulong *pp0, ulong *pp1)
+flfp0p1(Flayer *l, ulong *pp0, ulong *pp1, int *ticked)
{
long p0 = l->p0-l->origin, p1 = l->p1-l->origin;
- if(p0 < 0)
+ *ticked = 1;
+ if(p0 < 0){
+ *ticked = 0;
p0 = 0;
+ }
if(p1 < 0)
p1 = 0;
if(p0 > l->f.nchars)
p0 = l->f.nchars;
- if(p1 > l->f.nchars)
+ if(p1 > l->f.nchars){
+ *ticked = 0;
p1 = l->f.nchars;
+ }
*pp0 = p0;
*pp1 = p1;
}
@@ -401,6 +410,7 @@ flprepare(Flayer *l)
Frame *f;
ulong n;
Rune *r;
+ int ticked;
if(l->visible == None)
return 0;
@@ -418,8 +428,8 @@ flprepare(Flayer *l)
r = (*l->textfn)(l, n, &n);
frinsert(f, r, r+n, (ulong)0);
frdrawsel(f, frptofchar(f, f->p0), f->p0, f->p1, 0);
- flfp0p1(l, &f->p0, &f->p1);
- frdrawsel(f, frptofchar(f, f->p0), f->p0, f->p1, 1);
+ flfp0p1(l, &f->p0, &f->p1, &ticked);
+ frdrawseltick(f, frptofchar(f, f->p0), f->p0, f->p1, 1, ticked);
l->lastsr = ZR;
scrdraw(l, scrtotal(l));
}
diff --git a/src/cmd/samterm/flayer.h b/src/cmd/samterm/flayer.h
index 62c98076..8db79752 100644
--- a/src/cmd/samterm/flayer.h
+++ b/src/cmd/samterm/flayer.h
@@ -28,7 +28,7 @@ struct Flayer
void flborder(Flayer*, int);
void flclose(Flayer*);
void fldelete(Flayer*, long, long);
-void flfp0p1(Flayer*, ulong*, ulong*);
+void flfp0p1(Flayer*, ulong*, ulong*, int*);
void flinit(Flayer*, Rectangle, Font*, Image**);
void flinsert(Flayer*, Rune*, Rune*, long);
void flnew(Flayer*, Rune *(*fn)(Flayer*, long, ulong*), int, void*);