acme color and key diff
This commit is contained in:
commit
f4be7cb739
187
acme.diff
Normal file
187
acme.diff
Normal file
|
@ -0,0 +1,187 @@
|
|||
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..cecdd97b 100644
|
||||
--- a/src/cmd/acme/text.c
|
||||
+++ b/src/cmd/acme/text.c
|
||||
@@ -692,10 +692,16 @@ texttype(Text *t, Rune r)
|
||||
textshow(t, t->q1+1, t->q1+1, TRUE);
|
||||
return;
|
||||
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;
|
||||
@@ -712,8 +718,10 @@ texttype(Text *t, Rune r)
|
||||
case Kup:
|
||||
if(t->what == Tag)
|
||||
goto Tagup;
|
||||
- n = t->fr.maxlines/3;
|
||||
- goto case_Up;
|
||||
+ q0 = textbacknl(t, t->q0, 1);
|
||||
+ if(q0 > 1)
|
||||
+ textshow(t, q0-1, q0-1, TRUE);
|
||||
+ return;
|
||||
case Kscrolloneup:
|
||||
if(t->what == Tag)
|
||||
goto Tagup;
|
||||
@@ -725,7 +733,7 @@ texttype(Text *t, Rune r)
|
||||
q0 = textbacknl(t, t->org, n);
|
||||
textsetorigin(t, 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 +741,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 +753,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 +761,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 +807,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 +818,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 +838,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 +857,9 @@ 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 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);
|
9
acme.txt
Normal file
9
acme.txt
Normal file
|
@ -0,0 +1,9 @@
|
|||
Changes to acme
|
||||
===============
|
||||
|
||||
- changed color scheme to dark background and light text
|
||||
- changed keyboard shortcuts:
|
||||
- Down and Up now move the cursor to the end of the line below/above
|
||||
- switched behavior of Home/End with ^A/^E
|
||||
- Ctrl+c, Ctrl+x, Ctrl+v now work as expected
|
||||
- Ctrl+z for undo, Ctrl+y for redo
|
Loading…
Reference in New Issue
Block a user