From 73eea8402b54fca70d8f5eb414bf1bad00121665 Mon Sep 17 00:00:00 2001 From: BurnZeZ Date: Sun, 16 Nov 2014 09:58:21 -0500 Subject: [PATCH] abaco: cleanup, handle image/x-icon, don't use backspace as a hotkey, and remove urlconvience()/related functions --- sys/src/cmd/abaco/page.c | 6 +----- sys/src/cmd/abaco/text.c | 16 +++++++------- sys/src/cmd/abaco/urls.c | 45 ---------------------------------------- 3 files changed, 9 insertions(+), 58 deletions(-) diff --git a/sys/src/cmd/abaco/page.c b/sys/src/cmd/abaco/page.c index 8e46d41d7..e98d46921 100644 --- a/sys/src/cmd/abaco/page.c +++ b/sys/src/cmd/abaco/page.c @@ -73,6 +73,7 @@ static struct { "image/pjpeg", "jpg -t9", "image/png", "png -t9", "image/ppm", "ppm -t9", + "image/x-icon", "ico -c", nil, nil, }; @@ -713,11 +714,6 @@ pagetype(Page *p, Rune r, Point xy) b->key(b, p, r); return; } - /* ^H: same as 'Back' */ - if(r == 0x08){ - wingohist(p->w, FALSE); - return; - } x = 0; y = 0; diff --git a/sys/src/cmd/abaco/text.c b/sys/src/cmd/abaco/text.c index 8c145a154..14a069527 100644 --- a/sys/src/cmd/abaco/text.c +++ b/sys/src/cmd/abaco/text.c @@ -164,7 +164,7 @@ textbswidth(Text *t, Rune c) 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 @@ textbswidth(Text *t, Rune c) --q; break; } - if(c == 0x17){ + if(c == Ketb){ eq = isalnum(r); if(eq && skipping) /* found one; stop skipping */ skipping = FALSE; @@ -246,14 +246,14 @@ texttype(Text *t, Rune r) 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(q0rs.nr && t->rs.r[q0]!='\n') q0++; @@ -265,9 +265,9 @@ texttype(Text *t, Rune r) 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); diff --git a/sys/src/cmd/abaco/urls.c b/sys/src/cmd/abaco/urls.c index e8b919ef6..f88ef993d 100644 --- a/sys/src/cmd/abaco/urls.c +++ b/sys/src/cmd/abaco/urls.c @@ -70,57 +70,12 @@ getattr(int conn, char *s) 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) { char buf[BUFSIZE]; int cfd, fd, conn, n; - urlconvience(u); snprint(buf, sizeof(buf), "%s/clone", webmountpt); cfd = open(buf, ORDWR); if(cfd < 0)