ref: 73eea8402b54fca70d8f5eb414bf1bad00121665
parent: 170913631b65eec3076ddb098440e829a2dff9e0
author: BurnZeZ <[email protected]>
date: Sun Nov 16 04:58:21 EST 2014
abaco: cleanup, handle image/x-icon, don't use backspace as a hotkey, and remove urlconvience()/related functions
--- a/sys/src/cmd/abaco/page.c
+++ b/sys/src/cmd/abaco/page.c
@@ -73,6 +73,7 @@
"image/pjpeg", "jpg -t9",
"image/png", "png -t9",
"image/ppm", "ppm -t9",
+ "image/x-icon", "ico -c",
nil, nil,
};
@@ -711,11 +712,6 @@
b = boxwhich(p->lay, xy);
if(b && b->key){
b->key(b, p, r);
- return;
- }
- /* ^H: same as 'Back' */
- if(r == 0x08){
- wingohist(p->w, FALSE);
return;
}
--- a/sys/src/cmd/abaco/text.c
+++ b/sys/src/cmd/abaco/text.c
@@ -164,7 +164,7 @@
int skipping;
/* there is known to be at least one character to erase */
- if(c == 0x08) /* ^H: erase character */
+ if(c == Kbs) /* ^H: erase character */
return 1;
q = t->q0;
skipping = TRUE;
@@ -175,7 +175,7 @@
--q;
break;
}
- if(c == 0x17){
+ if(c == Ketb){
eq = isalnum(r);
if(eq && skipping) /* found one; stop skipping */
skipping = FALSE;
@@ -246,14 +246,14 @@
case Kend:
textshow(t, t->rs.nr, t->rs.nr, FALSE);
return;
- case 0x01: /* ^A: beginning of line */
+ case Ksoh: /* ^A: beginning of line */
/* go to where ^U would erase, if not already at BOL */
nb = 0;
if(t->q0>0 && t->rs.r[t->q0-1]!='\n')
- nb = textbswidth(t, 0x15);
+ nb = textbswidth(t, Knack);
textshow(t, t->q0-nb, t->q0-nb, TRUE);
return;
- case 0x05: /* ^E: end of line */
+ case Kenq: /* ^E: end of line */
q0 = t->q0;
while(q0<t->rs.nr && t->rs.r[q0]!='\n')
q0++;
@@ -265,9 +265,9 @@
textshow(t, t->q0, t->q0, TRUE);
switch(r){
- case 0x08: /* ^H: erase character */
- case 0x15: /* ^U: erase line */
- case 0x17: /* ^W: erase word */
+ case Kbs: /* ^H: erase character */
+ case Knack: /* ^U: erase line */
+ case Ketb: /* ^W: erase word */
if(t->q0 == 0) /* nothing to erase */
return;
nb = textbswidth(t, r);
--- a/sys/src/cmd/abaco/urls.c
+++ b/sys/src/cmd/abaco/urls.c
@@ -70,50 +70,6 @@
return (Runestr){runesmprint("%s", buf), n};
}
-// tired of typing http://, tired of going to google first.
-void
-justgoogleit(Url *u)
-{
- Rune *s;
-
- s = ucvt(u->src.r+2);
- free(u->src.r);
- u->src.r = runesmprint("http://www.google.com/search?hl=en&ie=UTF-8&q=%S", s);
- free(s);
- u->src.nr = runestrlen(u->src.r);
-}
-
-void
-addhttp(Url *u)
-{
- Rune *s;
- if(validurl(u->src.r))
- return;
- s = u->src.r;
- u->src.r = runesmprint("http://%S", u->src.r);
- free(s);
- u->src.nr = runestrlen(u->src.r);
-}
-
-struct{
- void (*f)(Url*);
- Rune *lead;
- int len;
-} ctab[] = {
- justgoogleit, L"g ", 2,
- addhttp, L"", 0,
-};
-
-void
-urlconvience(Url *u)
-{
- int i;
-
- for(i = 0; u->src.nr >= ctab[i].len && runestrncmp(u->src.r, ctab[i].lead, ctab[i].len) != 0; i++)
- ;
- ctab[i].f(u);
-}
-
int
urlopen(Url *u)
{
@@ -120,7 +76,6 @@
char buf[BUFSIZE];
int cfd, fd, conn, n;
- urlconvience(u);
snprint(buf, sizeof(buf), "%s/clone", webmountpt);
cfd = open(buf, ORDWR);
if(cfd < 0)