204 lines
6.0 KiB
Diff
204 lines
6.0 KiB
Diff
diff --git a/src/cmd/acme/acme.c b/src/cmd/acme/acme.c
|
|
index e5658a4e..2c79b387 100644
|
|
--- a/src/cmd/acme/acme.c
|
|
+++ b/src/cmd/acme/acme.c
|
|
@@ -1034,6 +1034,13 @@ Cursor2 boxcursor2 = {
|
|
0x00, 0x00, 0x00, 0x00}
|
|
};
|
|
|
|
+enum {
|
|
+ COLOR_FG = 0xE8E8E8FF,
|
|
+ COLOR_BG = 0x111111FF,
|
|
+ COLOR_LBG = 0x444444FF,
|
|
+ COLOR_HL = 0x666666FF
|
|
+};
|
|
+
|
|
void
|
|
iconinit(void)
|
|
{
|
|
@@ -1041,19 +1048,17 @@ iconinit(void)
|
|
Image *tmp;
|
|
|
|
if(tagcols[BACK] == nil) {
|
|
- /* Blue */
|
|
- tagcols[BACK] = allocimagemix(display, DPalebluegreen, DWhite);
|
|
- tagcols[HIGH] = allocimage(display, Rect(0,0,1,1), screen->chan, 1, DPalegreygreen);
|
|
- tagcols[BORD] = allocimage(display, Rect(0,0,1,1), screen->chan, 1, DPurpleblue);
|
|
- tagcols[TEXT] = display->black;
|
|
- tagcols[HTEXT] = display->black;
|
|
-
|
|
- /* Yellow */
|
|
- textcols[BACK] = allocimagemix(display, DPaleyellow, DWhite);
|
|
- textcols[HIGH] = allocimage(display, Rect(0,0,1,1), screen->chan, 1, DDarkyellow);
|
|
- textcols[BORD] = allocimage(display, Rect(0,0,1,1), screen->chan, 1, DYellowgreen);
|
|
- textcols[TEXT] = display->black;
|
|
- textcols[HTEXT] = display->black;
|
|
+ tagcols[BACK] = allocimage(display, Rect(0,0,1,1), RGBA32, 1, COLOR_LBG);
|
|
+ tagcols[HIGH] = allocimage(display, Rect(0,0,1,1), RGBA32, 1, COLOR_FG);
|
|
+ tagcols[BORD] = allocimage(display, Rect(0,0,1,1), RGBA32, 1, COLOR_FG);
|
|
+ tagcols[TEXT] = allocimage(display, Rect(0,0,1,1), RGBA32, 1, COLOR_FG);
|
|
+ tagcols[HTEXT] = allocimage(display, Rect(0,0,1,1), RGBA32, 1, COLOR_HL);
|
|
+
|
|
+ textcols[BACK] = allocimage(display, Rect(0,0,1,1), RGBA32, 1, COLOR_BG);
|
|
+ textcols[HIGH] = allocimage(display, Rect(0,0,1,1), RGBA32, 1, COLOR_FG);
|
|
+ textcols[BORD] = allocimage(display, Rect(0,0,1,1), RGBA32, 1, COLOR_LBG);
|
|
+ textcols[TEXT] = allocimage(display, Rect(0,0,1,1), RGBA32, 1, COLOR_FG);
|
|
+ textcols[HTEXT] = allocimage(display, Rect(0,0,1,1), RGBA32, 1, COLOR_HL);
|
|
}
|
|
|
|
r = Rect(0, 0, Scrollwid+ButtonBorder, font->height+1);
|
|
diff --git a/src/cmd/acme/text.c b/src/cmd/acme/text.c
|
|
index 09422dda..fc67ebad 100644
|
|
--- a/src/cmd/acme/text.c
|
|
+++ b/src/cmd/acme/text.c
|
|
@@ -694,8 +694,16 @@ texttype(Text *t, Rune r)
|
|
case Kdown:
|
|
if(t->what == Tag)
|
|
goto Tagdown;
|
|
- n = t->fr.maxlines/3;
|
|
- goto case_Down;
|
|
+ typecommit(t);
|
|
+ q0 = t->q0;
|
|
+ while(q0<t->file->b.nc && textreadc(t, q0)!='\n')
|
|
+ q0++;
|
|
+ if(q0<t->file->b.nc && textreadc(t, q0)=='\n')
|
|
+ q0++;
|
|
+ while(q0<t->file->b.nc && textreadc(t, q0)!='\n')
|
|
+ q0++;
|
|
+ textshow(t, q0, q0, TRUE);
|
|
+ return;
|
|
case Kscrollonedown:
|
|
if(t->what == Tag)
|
|
goto Tagdown;
|
|
@@ -708,12 +716,19 @@ texttype(Text *t, Rune r)
|
|
case_Down:
|
|
q0 = t->org+frcharofpt(&t->fr, Pt(t->fr.r.min.x, t->fr.r.min.y+n*t->fr.font->height));
|
|
textsetorigin(t, q0, TRUE);
|
|
+ if(n>10)
|
|
+ textshow(t, q0, q0, TRUE);
|
|
return;
|
|
case Kup:
|
|
if(t->what == Tag)
|
|
goto Tagup;
|
|
- n = t->fr.maxlines/3;
|
|
- goto case_Up;
|
|
+ typecommit(t);
|
|
+ nnb = 0;
|
|
+ if(t->q0 > 0 && textreadc(t, t->q0-1) != '\n')
|
|
+ nnb = textbswidth(t, 0x15);
|
|
+ if(t->q0-nnb > 0)
|
|
+ textshow(t, t->q0-nnb-1, t->q0-nnb-1, TRUE);
|
|
+ return;
|
|
case Kscrolloneup:
|
|
if(t->what == Tag)
|
|
goto Tagup;
|
|
@@ -724,8 +739,10 @@ texttype(Text *t, Rune r)
|
|
case_Up:
|
|
q0 = textbacknl(t, t->org, n);
|
|
textsetorigin(t, q0, TRUE);
|
|
+ if(n>10)
|
|
+ textshow(t, q0, q0, TRUE);
|
|
return;
|
|
- case Khome:
|
|
+ case 0x01: /* ^A: beginning of file */
|
|
typecommit(t);
|
|
if(t->org > t->iq1) {
|
|
q0 = textbacknl(t, t->iq1, 1);
|
|
@@ -733,7 +750,7 @@ texttype(Text *t, Rune r)
|
|
} else
|
|
textshow(t, 0, 0, FALSE);
|
|
return;
|
|
- case Kend:
|
|
+ case 0x05: /* ^E: end of file */
|
|
typecommit(t);
|
|
if(t->iq1 > t->org+t->fr.nchars) {
|
|
if(t->iq1 > t->file->b.nc) {
|
|
@@ -745,7 +762,7 @@ texttype(Text *t, Rune r)
|
|
} else
|
|
textshow(t, t->file->b.nc, t->file->b.nc, FALSE);
|
|
return;
|
|
- case 0x01: /* ^A: beginning of line */
|
|
+ case Khome: /* beginning of line */
|
|
typecommit(t);
|
|
/* go to where ^U would erase, if not already at BOL */
|
|
nnb = 0;
|
|
@@ -753,22 +770,25 @@ texttype(Text *t, Rune r)
|
|
nnb = textbswidth(t, 0x15);
|
|
textshow(t, t->q0-nnb, t->q0-nnb, TRUE);
|
|
return;
|
|
- case 0x05: /* ^E: end of line */
|
|
+ case Kend: /* end of line */
|
|
typecommit(t);
|
|
q0 = t->q0;
|
|
while(q0<t->file->b.nc && textreadc(t, q0)!='\n')
|
|
q0++;
|
|
textshow(t, q0, q0, TRUE);
|
|
return;
|
|
- case Kcmd+'c': /* %C: copy */
|
|
+ case Kcmd+'c': /* %C: copy */
|
|
+ case 0x03: /* ^C */
|
|
typecommit(t);
|
|
cut(t, t, nil, TRUE, FALSE, nil, 0);
|
|
return;
|
|
- case Kcmd+'z': /* %Z: undo */
|
|
- typecommit(t);
|
|
+ case Kcmd+'z': /* %Z: undo */
|
|
+ case 0x1A: /* ^Z */
|
|
+ typecommit(t);
|
|
undo(t, nil, nil, TRUE, 0, nil, 0);
|
|
return;
|
|
- case Kcmd+'Z': /* %-shift-Z: redo */
|
|
+ case Kcmd+'Z': /* %-shift-Z: redo */
|
|
+ case 0x19: /* ^Y */
|
|
typecommit(t);
|
|
undo(t, nil, nil, FALSE, 0, nil, 0);
|
|
return;
|
|
@@ -796,7 +816,8 @@ texttype(Text *t, Rune r)
|
|
}
|
|
/* cut/paste must be done after the seq++/filemark */
|
|
switch(r){
|
|
- case Kcmd+'x': /* %X: cut */
|
|
+ case Kcmd+'x': /* %X: cut */
|
|
+ case 0x18: /* ^X */
|
|
typecommit(t);
|
|
if(t->what == Body){
|
|
seq++;
|
|
@@ -806,7 +827,8 @@ texttype(Text *t, Rune r)
|
|
textshow(t, t->q0, t->q0, 1);
|
|
t->iq1 = t->q0;
|
|
return;
|
|
- case Kcmd+'v': /* %V: paste */
|
|
+ case Kcmd+'v': /* %V: paste */
|
|
+ case 0x16: /* ^V */
|
|
typecommit(t);
|
|
if(t->what == Body){
|
|
seq++;
|
|
@@ -825,7 +847,7 @@ texttype(Text *t, Rune r)
|
|
}
|
|
textshow(t, t->q0, t->q0, 1);
|
|
switch(r){
|
|
- case 0x06: /* ^F: complete */
|
|
+ case 0x06: /* ^F: complete */
|
|
case Kins:
|
|
typecommit(t);
|
|
rp = textcomplete(t);
|
|
@@ -844,9 +866,15 @@ texttype(Text *t, Rune r)
|
|
typecommit(t);
|
|
t->iq1 = t->q0;
|
|
return;
|
|
- case 0x08: /* ^H: erase character */
|
|
- case 0x15: /* ^U: erase line */
|
|
- case 0x17: /* ^W: erase word */
|
|
+ case 0x7F: /* DEL: erase character in front */
|
|
+ if (t->q0>=t->file->b.nc)
|
|
+ return;
|
|
+ if (t->q0 == t->q1)
|
|
+ textshow(t, t->q0+1, t->q0+1,TRUE);
|
|
+ r = 0x08;
|
|
+ case 0x08: /* ^H: erase character */
|
|
+ case 0x15: /* ^U: erase line */
|
|
+ case 0x17: /* ^W: erase word */
|
|
if(t->q0 == 0) /* nothing to erase */
|
|
return;
|
|
nnb = textbswidth(t, r);
|