diff --git a/README.md b/README.md index 9670f39..865c263 100644 --- a/README.md +++ b/README.md @@ -44,9 +44,29 @@ Users unfamiliar with `acme` in general should check the following resources: After building, run `./install.sh`; If run as a regular user, it will install to `~/bin/9`; if run as root, it will overwrite the systemwide `acme` in `$PLAN9/bin` -## TODO +## helpers -- [ ] compile helpers +The `scripts` directory contains some helpers, mostly just shortcuts for [acme-lsp](https://github.com/fhs/acme-lsp). Copy them to your `$PATH` and let 'em rip. + +Of particular interest: + +- `agols`: pass a colon-separated list of workspaces to start `acme-lsp` for go development +- `atsls`: run without arguments to start `acme-lsp` for javascript/typescript development +- `acls`: run without arguments to start `acme-lsp` for C/C++ development + +For `acls` to work right with plan9port C stuff you will need to add your `$PLAN9/include` directory to the compile flags in either the project `.clangd` file or your `~/.config/clangd/config.yaml`: + +``` +CompileFlags: + Add: + - "-I/usr/lib/plan9/include" +``` + +See also: + +- [plumbing rules](https://nilfm.cc/git/dotfiles/tree/plumbing) - my plumbing rules, includes opening headers by right-click on the filename in an include directive + +The `Toolbox` file contains a compilation of `sam` command language (`Edit` scripts) that may be useful. ## thanks diff --git a/Toolbox b/Toolbox new file mode 100644 index 0000000..dc46c58 --- /dev/null +++ b/Toolbox @@ -0,0 +1,8 @@ +# Compiled Edit scripts + +[ Edit 1,$-1d ] # clear win +[ Edit x/^[ ]*/ a/# / ] # comment (replace # with comment prefix) +[ Edit x/^[ ]*# ?/ x/# ?/d ] # uncomment (replace # with comment prefix) +[ Edit s/^[ ]//g ] # unindent +[ Edit s/^/ /g ] # indent +[ Edit x/[^\n]\n[^\n]/ s/\n/ / ] # join lines \ No newline at end of file diff --git a/acme.c b/acme.c index a1c6e99..a98492c 100644 --- a/acme.c +++ b/acme.c @@ -43,7 +43,7 @@ Rune snarfrune[NSnarf + 1]; char* fontnames[2] = {PRIMARY_FONT, SECONDARY_FONT}; -char version[] = "acme9k v9001-a03"; +char version[] = "acme9k v9001-a04"; Command* command; @@ -512,7 +512,7 @@ void mousethread(void* v) { static Alt alts[NMALT + 1]; /* make sure we don't recklessly refresh the ticks */ - Text* oldbarttext; + Text* oldbarttext = nil; USED(v); threadsetname("mousethread"); @@ -676,8 +676,11 @@ void mousethread(void* v) { } Continue: /* won't refresh ticks if scrolling didn't change the active frame! */ - if (oldbarttext != barttext && (m.buttons) && t) { - textsettick(t, t->row); + if ( + (oldbarttext != barttext && (m.buttons & (8 | 16)) || + m.buttons & (1 | 2 | 4)) && + t) { + textsettick(barttext, &row); } qunlock(&row.lk); break; @@ -988,7 +991,7 @@ Cursor2 boxcursor2 = { 0xFF, 0xFF, 0xFC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}}; void iconinit(void) { - Rectangle r, r1; + Rectangle r; Image* tmp; if (tagcols[BACK] == nil) { diff --git a/cols.c b/cols.c index 1cf9dd9..eb17cc8 100644 --- a/cols.c +++ b/cols.c @@ -11,6 +11,7 @@ #include #include "dat.h" #include "fns.h" +#include "config.h" static Rune Lheader[] = {'N', 'e', 'w', ' ', 'C', 'u', 't', ' ', 'P', 'a', 's', 't', 'e', ' ', 'S', 'n', 'a', 'r', 'f', ' ', @@ -24,7 +25,7 @@ void colinit(Column* c, Rectangle r) { draw( screen, r, - allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, 0x222222FF), + allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, COLOR_EMPTY), nil, ZP); c->r = r; @@ -42,7 +43,7 @@ void colinit(Column* c, Rectangle r) { draw( screen, r1, - allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, 0x222222FF), + allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, COLOR_EMPTY), nil, ZP); textinsert(t, 0, Lheader, 38, TRUE); @@ -124,7 +125,7 @@ Window* coladd(Column* c, Window* w, Window* clone, int y) { draw( screen, r1, - allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, 0x222222FF), + allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, COLOR_EMPTY), nil, ZP); @@ -192,7 +193,7 @@ Found: draw( screen, r, - allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, 0x222222FF), + allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, COLOR_EMPTY), nil, ZP); return; @@ -253,7 +254,7 @@ void colresize(Column* c, Rectangle r) { draw( screen, r1, - allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, 0x222222FF), + allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, COLOR_EMPTY), nil, ZP); r1.max.y = r.max.y; @@ -274,7 +275,7 @@ void colresize(Column* c, Rectangle r) { draw( screen, r2, - allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, 0x222222FF), + allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, COLOR_EMPTY), nil, ZP); r1.min.y = r2.max.y; @@ -330,7 +331,7 @@ void colsort(Column* c) { draw( screen, r1, - allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, 0x222222FF), + allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, COLOR_EMPTY), nil, ZP); r.min.y = r1.max.y; @@ -431,7 +432,7 @@ Pack: draw( screen, r, - allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, 0x222222FF), + allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, COLOR_EMPTY), nil, ZP); y1 = r.max.y; @@ -463,7 +464,7 @@ Pack: draw( screen, r, - allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, 0x222222FF), + allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, COLOR_EMPTY), nil, ZP); for (j = i + 1; j < c->nw; j++) @@ -485,7 +486,7 @@ Pack: draw( screen, r, - allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, 0x222222FF), + allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, COLOR_EMPTY), nil, ZP); y1 = r.max.y; @@ -572,7 +573,7 @@ Found: draw( screen, r, - allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, 0x222222FF), + allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, COLOR_EMPTY), nil, ZP); r.min.y = r.max.y; diff --git a/config.def.h b/config.def.h index 64b9269..fe23335 100644 --- a/config.def.h +++ b/config.def.h @@ -25,7 +25,7 @@ /* button colors: dirty file (mod) indicator and column handles */ #define COLOR_BTN_MD 0x1F9B92FF -#define COLOR_BTN_CO 0x586E75FF +#define COLOR_BTN_CO 0x002B36FF /* button 2 and 3 selection colors */ diff --git a/look.c b/look.c index b7b9930..88d35d1 100644 --- a/look.c +++ b/look.c @@ -845,10 +845,11 @@ Window* openfile(Text* t, Expand* e) { textshow(t, r.q0, r.q1, 1); winsettag(t->w); seltext = t; - if (e->jump) + if (e->jump) { moveto( mousectl, addpt(frptofchar(&t->fr, t->fr.p0), Pt(4, font->height - 4))); + } return w; } diff --git a/rows.c b/rows.c index 55d45db..1d2e297 100644 --- a/rows.c +++ b/rows.c @@ -12,6 +12,7 @@ #include #include "dat.h" #include "fns.h" +#include "config.h" static Rune Lcolhdr[] = {'N', 'e', 'w', 'c', 'o', 'l', ' ', 'K', 'i', 'l', 'l', ' ', 'P', 'u', 't', 'a', 'l', 'l', ' ', 'D', @@ -24,7 +25,7 @@ void rowinit(Row* row, Rectangle r) { draw( screen, r, - allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, 0x222222FF), + allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, COLOR_EMPTY), nil, ZP); row->r = r; @@ -48,7 +49,7 @@ void rowinit(Row* row, Rectangle r) { draw( screen, r1, - allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, 0x222222FF), + allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, COLOR_EMPTY), nil, ZP); textinsert(t, 0, Lcolhdr, 29, TRUE); @@ -82,7 +83,7 @@ Column* rowadd(Row* row, Column* c, int x) { draw( screen, r, - allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, 0x222222FF), + allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, COLOR_EMPTY), nil, ZP); r1 = r; @@ -95,7 +96,7 @@ Column* rowadd(Row* row, Column* c, int x) { draw( screen, r1, - allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, 0x222222FF), + allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, COLOR_EMPTY), nil, ZP); r.min.x = r1.max.x; @@ -132,7 +133,7 @@ void rowresize(Row* row, Rectangle r) { draw( screen, r1, - allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, 0x222222FF), + allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, COLOR_EMPTY), nil, ZP); r.min.y = r1.max.y; @@ -152,7 +153,7 @@ void rowresize(Row* row, Rectangle r) { draw( screen, r2, - allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, 0x222222FF), + allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, COLOR_EMPTY), nil, ZP); r1.min.x = r2.max.x; @@ -218,7 +219,7 @@ Found: draw( screen, r, - allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, 0x222222FF), + allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, COLOR_EMPTY), nil, ZP); r.max.x = p.x; @@ -230,7 +231,7 @@ Found: draw( screen, r, - allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, 0x222222FF), + allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, COLOR_EMPTY), nil, ZP); r.min.x = r.max.x; @@ -258,7 +259,7 @@ Found: draw( screen, r, - allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, 0x222222FF), + allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, COLOR_EMPTY), nil, ZP); return; @@ -274,7 +275,7 @@ Found: draw( screen, r, - allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, 0x222222FF), + allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, COLOR_EMPTY), nil, ZP); colresize(c, r); @@ -633,7 +634,7 @@ int rowload(Row* row, char* file, int initing) { draw( screen, Rpt(r1.min, r2.max), - allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, 0x222222FF), + allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, COLOR_EMPTY), nil, ZP); colresize(c1, r1); @@ -643,7 +644,7 @@ int rowload(Row* row, char* file, int initing) { draw( screen, r2, - allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, 0x222222FF), + allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, COLOR_EMPTY), nil, ZP); } diff --git a/scripts/Lassist b/scripts/Lassist new file mode 100755 index 0000000..c6e1ab8 --- /dev/null +++ b/scripts/Lassist @@ -0,0 +1,2 @@ +#!/bin/sh +exec L assist diff --git a/scripts/Lcomp b/scripts/Lcomp new file mode 100755 index 0000000..8792935 --- /dev/null +++ b/scripts/Lcomp @@ -0,0 +1,2 @@ +#!/bin/sh +exec L comp diff --git a/scripts/Ldef b/scripts/Ldef new file mode 100755 index 0000000..9c076b7 --- /dev/null +++ b/scripts/Ldef @@ -0,0 +1,2 @@ +#!/bin/sh +exec L def diff --git a/scripts/Lfmt b/scripts/Lfmt new file mode 100755 index 0000000..307de21 --- /dev/null +++ b/scripts/Lfmt @@ -0,0 +1,2 @@ +#!/bin/sh +exec L fmt diff --git a/scripts/Lhov b/scripts/Lhov new file mode 100755 index 0000000..f86ad25 --- /dev/null +++ b/scripts/Lhov @@ -0,0 +1,2 @@ +#!/bin/sh +exec L hov diff --git a/scripts/Limpls b/scripts/Limpls new file mode 100755 index 0000000..7bcea65 --- /dev/null +++ b/scripts/Limpls @@ -0,0 +1,2 @@ +#!/bin/sh +exec L impls diff --git a/scripts/Lrefs b/scripts/Lrefs new file mode 100755 index 0000000..23bc5bc --- /dev/null +++ b/scripts/Lrefs @@ -0,0 +1,2 @@ +#!/bin/sh +exec L refs diff --git a/scripts/Lrn b/scripts/Lrn new file mode 100755 index 0000000..afa6e58 --- /dev/null +++ b/scripts/Lrn @@ -0,0 +1,2 @@ +#!/bin/sh +exec L rn diff --git a/scripts/Lsig b/scripts/Lsig new file mode 100755 index 0000000..6f84623 --- /dev/null +++ b/scripts/Lsig @@ -0,0 +1,2 @@ +#!/bin/sh +exec L sig diff --git a/scripts/Lsyms b/scripts/Lsyms new file mode 100755 index 0000000..5e4faa7 --- /dev/null +++ b/scripts/Lsyms @@ -0,0 +1,2 @@ +#!/bin/sh +exec L syms diff --git a/scripts/Ltype b/scripts/Ltype new file mode 100755 index 0000000..bd44fbd --- /dev/null +++ b/scripts/Ltype @@ -0,0 +1,2 @@ +#!/bin/sh +exec L type diff --git a/scripts/Lws b/scripts/Lws new file mode 100755 index 0000000..0edde32 --- /dev/null +++ b/scripts/Lws @@ -0,0 +1,2 @@ +#!/bin/sh +exec L ws diff --git a/scripts/Lws+ b/scripts/Lws+ new file mode 100755 index 0000000..2a08fef --- /dev/null +++ b/scripts/Lws+ @@ -0,0 +1,2 @@ +#!/bin/sh +exec L ws+ diff --git a/scripts/Lws- b/scripts/Lws- new file mode 100755 index 0000000..a7f6bef --- /dev/null +++ b/scripts/Lws- @@ -0,0 +1,2 @@ +#!/bin/sh +exec L ws- diff --git a/scripts/acls b/scripts/acls new file mode 100755 index 0000000..e47fa5c --- /dev/null +++ b/scripts/acls @@ -0,0 +1,3 @@ +#!/bin/sh +export CFLAGS="-I${PLAN9}/include" +exec acme-lsp -server '(\.c)|(\.h)|(\.cc)|(\.hh)|(\.cpp)|(\.hpp)$:clangd -log=error --background-index --limit-results=500 --completion-style=bundled' \ No newline at end of file diff --git a/scripts/agols b/scripts/agols new file mode 100755 index 0000000..350c81b --- /dev/null +++ b/scripts/agols @@ -0,0 +1,2 @@ +#!/bin/sh +exec acme-lsp -server '([/\\]go\.mod)|([/\\]go\.sum)|(\.go)$:gopls serve' -workspaces $@ \ No newline at end of file diff --git a/scripts/atsls b/scripts/atsls new file mode 100755 index 0000000..771a4bb --- /dev/null +++ b/scripts/atsls @@ -0,0 +1,2 @@ +#!/bin/sh +exec acme-lsp -server '(\.ts)|(\.js)|(\.jsx)|(\.tsx)$:typescript-language-server --stdio' \ No newline at end of file diff --git a/text.c b/text.c index f266e26..ee75b95 100644 --- a/text.c +++ b/text.c @@ -59,10 +59,14 @@ void textsettick(Text* t, Row* r) { _textsettick(t, &cptr->tag); for (wcnt = 0; wcnt < cptr->nw; wcnt++) { wptr = cptr->w[wcnt]; - winlock(wptr, 'M'); + /*if (!wptr->isdir) { + winlock(wptr, 'M'); + }*/ _textsettick(t, &wptr->tag); _textsettick(t, &wptr->body); - winunlock(wptr); + /*if (!wptr->isdir) { + winunlock(wptr); + }*/ } } /* force redraw to refresh all ticks;