libframe: use correct text color when painting
R=rsc CC=plan9port.codebot http://codereview.appspot.com/6625065
This commit is contained in:
parent
ef99c9f1ae
commit
c3feb5c5c1
1 changed files with 12 additions and 6 deletions
|
|
@ -101,7 +101,7 @@ frinsert(Frame *f, Rune *sp, Rune *ep, ulong p0)
|
||||||
Frbox *b;
|
Frbox *b;
|
||||||
int n, n0, nn0, y;
|
int n, n0, nn0, y;
|
||||||
ulong cn0;
|
ulong cn0;
|
||||||
Image *col;
|
Image *col, *tcol;
|
||||||
Rectangle r;
|
Rectangle r;
|
||||||
static struct{
|
static struct{
|
||||||
Point pt0, pt1;
|
Point pt0, pt1;
|
||||||
|
|
@ -245,10 +245,13 @@ frinsert(Frame *f, Rune *sp, Rune *ep, ulong p0)
|
||||||
if(r.max.x >= f->r.max.x)
|
if(r.max.x >= f->r.max.x)
|
||||||
r.max.x = f->r.max.x;
|
r.max.x = f->r.max.x;
|
||||||
cn0--;
|
cn0--;
|
||||||
if(f->p0<=cn0 && cn0<f->p1) /* b is inside selection */
|
if(f->p0<=cn0 && cn0<f->p1){ /* b is inside selection */
|
||||||
col = f->cols[HIGH];
|
col = f->cols[HIGH];
|
||||||
else
|
tcol = f->cols[HTEXT];
|
||||||
|
}else{
|
||||||
col = f->cols[BACK];
|
col = f->cols[BACK];
|
||||||
|
tcol = f->cols[TEXT];
|
||||||
|
}
|
||||||
draw(f->b, r, col, nil, r.min);
|
draw(f->b, r, col, nil, r.min);
|
||||||
y = 0;
|
y = 0;
|
||||||
if(pt.x == f->r.min.x)
|
if(pt.x == f->r.min.x)
|
||||||
|
|
@ -256,12 +259,15 @@ frinsert(Frame *f, Rune *sp, Rune *ep, ulong p0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* insertion can extend the selection, so the condition here is different */
|
/* insertion can extend the selection, so the condition here is different */
|
||||||
if(f->p0<p0 && p0<=f->p1)
|
if(f->p0<p0 && p0<=f->p1){
|
||||||
col = f->cols[HIGH];
|
col = f->cols[HIGH];
|
||||||
else
|
tcol = f->cols[HTEXT];
|
||||||
|
}else{
|
||||||
col = f->cols[BACK];
|
col = f->cols[BACK];
|
||||||
|
tcol = f->cols[TEXT];
|
||||||
|
}
|
||||||
frselectpaint(f, ppt0, ppt1, col);
|
frselectpaint(f, ppt0, ppt1, col);
|
||||||
_frdrawtext(&frame, ppt0, f->cols[TEXT], col);
|
_frdrawtext(&frame, ppt0, tcol, col);
|
||||||
_fraddbox(f, nn0, frame.nbox);
|
_fraddbox(f, nn0, frame.nbox);
|
||||||
for(n=0; n<frame.nbox; n++)
|
for(n=0; n<frame.nbox; n++)
|
||||||
f->box[nn0+n] = frame.box[n];
|
f->box[nn0+n] = frame.box[n];
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue