commit cc22e2e
ohmu
·
2026-07-30 22:13:01 +0300 MSK
parent 0cd5cec
added more configuration things, fixed multiple windows crash, fixed pastel, and new flags and some i forgot what
9 files changed,
+181,
-173
+75,
-83
1@@ -9,6 +9,8 @@
2 #include <fcall.h>
3 #include <plumb.h>
4 #include <libsec.h>
5+#include <unistd.h>
6+#include <sys/stat.h>
7
8 #include "dat.h"
9 #include "fns.h"
10@@ -36,7 +38,6 @@ char wdir[512] = ".";
11 char *fontnames[2];
12 Reffont *reffonts[2];
13 int snarffd = -1;
14-int mainpid;
15 char *mtpt;
16
17 enum{
18@@ -65,56 +66,19 @@ threadmain(int argc, char *argv[])
19 char *p, *loadfile;
20 Column *c;
21 Display *d;
22+ char mtptbuf[256];
23 rfork(RFENVG|RFNAMEG);
24-
25- init_config();
26-
27+
28 loadfile = nil;
29+ PID = getpid();
30+
31 ARGBEGIN{
32 case 'D':
33 {extern int _threaddebuglevel;
34 _threaddebuglevel = ~0;
35 }
36 break;
37- case 'a':
38- if(globalautoindent)
39- globalautoindent = FALSE;
40- else
41- globalautoindent = TRUE;
42- break;
43-
44-/* bartmode/flag is now an option to be turned on config.h, just
45- * because it is way too useful to leave it as an meaningless
46- * flag, especially since considering how almost everyone seems
47- * to even miss its existence.
48- *
49- * to get to the point, it denies window focus following mouse.
50- * how fickle those mice can truly be when decieveth by a soothing
51- * treat, a teat or two.
52- */
53-
54-/* case 'b':
55- bartflag = TRUE;
56- break; */
57
58- case 'c':
59- p = ARGF();
60- if(p == nil)
61- goto Usage;
62- ncol = atoi(p);
63- if(ncol <= 0)
64- goto Usage;
65- break;
66- case 'f':
67- fontnames[0] = ARGF();
68- if(fontnames[0] == nil)
69- goto Usage;
70- break;
71- case 'F':
72- fontnames[1] = ARGF();
73- if(fontnames[1] == nil)
74- goto Usage;
75- break;
76 case 'l':
77 loadfile = ARGF();
78 if(loadfile == nil)
79@@ -125,20 +89,30 @@ threadmain(int argc, char *argv[])
80 if(mtpt == nil)
81 goto Usage;
82 break;
83- case 'r':
84- swapscrollbuttons = TRUE;
85- break;
86- case 'W':
87+ case 'w':
88 winsize = ARGF();
89 if(winsize == nil)
90 goto Usage;
91 break;
92+ case 'c':
93+ customconfigpath = ARGF();
94+ if (customconfigpath == nil)
95+ goto Usage;
96+ break;
97 default:
98 Usage:
99- fprint(2, "usage: acme -a -c ncol -f fontname -F fixedwidthfontname -l loadfile -W winsize\n");
100+ fprint(2, "usage: acme -m mountpoint -l dumpfile -w winsize -c custom_config WxH\n");
101 threadexitsall("usage");
102 }ARGEND
103
104+ if(mtpt == nil){
105+ snprintf(mtptbuf, sizeof(mtptbuf), "/tmp/acme.%d", PID);
106+ mtpt = mtptbuf;
107+ mkdir(mtpt, 0700);
108+ }
109+
110+ initconfig(customconfigpath);
111+
112 quotefmtinstall();
113 fmtinstall('t', timefmt);
114
115@@ -228,7 +202,6 @@ threadmain(int argc, char *argv[])
116 fprint(2, "acme: can't initialize keyboard: %r\n");
117 threadexitsall("keyboard");
118 }
119- mainpid = getpid();
120 startplumbing();
121 /*
122 plumbeditfd = plumbopen("edit", OREAD|OCEXEC);
123@@ -264,19 +237,20 @@ threadmain(int argc, char *argv[])
124 error("initializing columns");
125 }
126 c = row.col[row.ncol-1];
127- if (opendir) {
128- if(argc == 0)
129+ if (openarg) {
130+ if (argc == 0)
131 readfile(c, wdir);
132- else
133- for(i=0; i<argc; i++){
134- p = utfrrune(argv[i], '/');
135- if((p!=nil && strcmp(p, "/guide")==0) || i/WPERCOL>=row.ncol)
136- readfile(c, argv[i]);
137- else
138- readfile(row.col[i/WPERCOL], argv[i]);
139- }
140- }
141- }
142+ else {
143+ for(i=0; i<argc; i++){
144+ p = utfrrune(argv[i], '/');
145+ if((p!=nil && strcmp(p, "/guide")==0) || i/WPERCOL>=row.ncol)
146+ readfile(c, argv[i]);
147+ else
148+ readfile(row.col[i/WPERCOL], argv[i]);
149+ }
150+ }
151+ }
152+ }
153 flushimage(display, 1);
154
155 acmeerrorinit();
156@@ -348,7 +322,7 @@ shutdown(void *v, char *msg)
157 return 1;
158
159 killprocs();
160- if(!dumping && strcmp(msg, "kill")!=0 && strcmp(msg, "exit")!=0 && getpid()==mainpid){
161+ if(!dumping && strcmp(msg, "kill")!=0 && strcmp(msg, "exit")!=0 && getpid()==PID){
162 dumping = TRUE;
163 rowdump(&row, nil);
164 }
165@@ -414,7 +388,7 @@ acmeerrorinit(void)
166 if(pipe(pfd) < 0)
167 error("can't create pipe");
168 #if 0
169- sprint(acmeerrorfile, "/srv/acme.%s.%d", getuser(), mainpid);
170+ sprint(acmeerrorfile, "/srv/acme.%s.%d", getuser(), PID);
171 fd = create(acmeerrorfile, OWRITE, 0666);
172 if(fd < 0){
173 remove(acmeerrorfile);
174@@ -983,20 +957,26 @@ iconinit(void)
175
176 if(tagcols[BACK] == nil) {
177 if (ENABLE_PASTELS)
178- tagcols[BACK] = allocimage(display, Rect(0,0,1,1), RGBA32, 1, C_TAGBG);
179+ tagcols[BACK] = allocimagemix(display, C_TAGBG, C_MIX);
180 else
181- tagcols[BACK] = allocimagemix(display, C_TAGBG, C_MIX);
182+ tagcols[BACK] = allocimage(display, Rect(0,0,1,1), RGBA32, 1, C_TAGBG);
183 tagcols[HIGH] = allocimage(display, Rect(0,0,1,1), RGBA32, 1, C_TAGHLBG);
184 tagcols[BORD] = allocimage(display, Rect(0,0,1,1), RGBA32, 1, C_COLBUTTON);
185 tagcols[TEXT] = allocimage(display, Rect(0,0,1,1), RGBA32, 1, C_TAGFG);
186 tagcols[HTEXT] = allocimage(display, Rect(0,0,1,1), RGBA32, 1, C_TAGHLFG);
187
188 if (ENABLE_PASTELS)
189- textcols[BACK] = allocimage(display, Rect(0,0,1,1), RGBA32, 1, C_TXTBG);
190+ textcols[BACK] = allocimagemix(display, C_TXTBG, C_MIX);
191 else
192- textcols[BACK] = allocimagemix(display, C_TXTBG, C_MIX);
193+ textcols[BACK] = allocimage(display, Rect(0,0,1,1), RGBA32, 1, C_TXTBG);
194 textcols[HIGH] = allocimage(display, Rect(0,0,1,1), RGBA32, 1, C_TXTHLBG);
195- textcols[BORD] = allocimage(display, Rect(0,0,1,1), RGBA32, 1, C_SCROLLBG);
196+ if (coolscrollbg) {
197+ textcols[BORD] = allocimage(display, Rect(0,0,2,2), CMAP8, 1, 0x000000FF);
198+ draw(textcols[BORD], Rect(1,1,2,2), display->white, nil, ZP);
199+ draw(textcols[BORD], Rect(0,0,1,1), display->white, nil, ZP);
200+ } else {
201+ textcols[BORD] = allocimage(display, Rect(0,0,1,1), RGBA32, 1, C_SCROLLBG);
202+ }
203 textcols[TEXT] = allocimage(display, Rect(0,0,1,1), RGBA32, 1, C_TXTFG);
204 textcols[HTEXT] = allocimage(display, Rect(0,0,1,1), RGBA32, 1, C_TXTHLFG);
205
206@@ -1011,21 +991,34 @@ iconinit(void)
207 freeimage(modbutton);
208 freeimage(colbutton);
209 }
210-
211- button = allocimage(display, r, screen->chan, 0, DNofill);
212- draw(button, r, tagcols[BACK], nil, r.min);
213- r.max.x -= ButtonBorder;
214- border(button, r, ButtonBorder, tagcols[BORD], ZP);
215-
216- r = button->r;
217- modbutton = allocimage(display, r, screen->chan, 0, DNofill);
218- draw(modbutton, r, tagcols[BACK], nil, r.min);
219- r.max.x -= ButtonBorder;
220- border(modbutton, r, ButtonBorder, tagcols[BORD], ZP);
221- r = insetrect(r, ButtonBorder);
222- tmp = allocimage(display, Rect(0,0,1,1), RGBA32, 1, C_TMPBUTTON);
223- draw(modbutton, r, tmp, nil, ZP);
224- freeimage(tmp);
225+ if (coolcolbtn) {
226+ r = Rect(0, 0, Scrollwid, font->height+1);
227+ button = allocimage(display, r, screen->chan, 0, DNofill);
228+ draw(button, r, tagcols[BORD], nil, r.min);
229+ r.max.x -= 4;
230+ fillellipse(button, (Point){r.min.x + 5, r.min.y + 7}, 3, 3, tagcols[BACK], ZP);
231+ r = button->r;
232+ modbutton = allocimage(display, r, screen->chan, 0, DNofill);
233+ draw(modbutton, r, tagcols[BORD], nil, r.min);
234+ r = insetrect(r, 2);
235+ tmp = allocimage(display, Rect(0,0,1,1), RGBA32, 1, C_TMPBUTTON);
236+ fillellipse(modbutton, (Point){r.min.x + 3, r.min.y + 5}, 3, 3, tmp, ZP);
237+ } else {
238+ button = allocimage(display, r, screen->chan, 0, DNofill);
239+ draw(button, r, tagcols[BACK], nil, r.min);
240+ r.max.x -= ButtonBorder;
241+ border(button, r, ButtonBorder, tagcols[BORD], ZP);
242+
243+ r = button->r;
244+ modbutton = allocimage(display, r, screen->chan, 0, DNofill);
245+ draw(modbutton, r, tagcols[BACK], nil, r.min);
246+ r.max.x -= ButtonBorder;
247+ border(modbutton, r, ButtonBorder, tagcols[BORD], ZP);
248+ r = insetrect(r, ButtonBorder);
249+ tmp = allocimage(display, Rect(0,0,1,1), RGBA32, 1, C_TMPBUTTON);
250+ draw(modbutton, r, tmp, nil, ZP);
251+ freeimage(tmp);
252+ }
253
254 r = button->r;
255 colbutton = allocimage(display, r, RGBA32, 1, C_WINBUTTON);
256@@ -1033,7 +1026,6 @@ iconinit(void)
257 but2col = allocimage(display, r, screen->chan, 1, C_BUTTON2HL);
258 but3col = allocimage(display, r, screen->chan, 1, C_BUTTON3HL);
259 }
260-
261 /*
262 * /dev/snarf updates when the file is closed, so we must open our own
263 * fd here rather than use snarffd
+4,
-31
1@@ -1,7 +1,7 @@
2 " settings
3
4-mainfont /home/glenda/src/fonts/GoMonoNF/13a/font
5-monofont /home/glenda/src/fonts/GoMonoNF/13a/font
6+@include .acmethemes/bw
7+
8 dumppath /home/glenda/.acme.dump
9 shell /bin/rc
10
11@@ -9,32 +9,5 @@ autoindent 1
12 swpscrllbtns 0
13 clicktofocus 0
14 colcount 1
15-opendir 0
16-
17-" theming
18-
19-pastels 1
20-
21-mix eaddd0
22-
23-root f6efe5
24-
25-tagbg f6efe5
26-tagfg 5c4a3a
27-htagbg b08060
28-htagfg ffffff
29-
30-txtbg f6efe5
31-txtfg 5c4a3a
32-htxtbg b08060
33-htxtfg ffffff
34-
35-winbtn 6b5445
36-colbtn 8c7a64
37-tmpbtn 8c7a64
38-scrlbg 9c8271
39-
40-border 8c7a64
41-
42-btn2hl b08060
43-btn3hl b08060
44+openarg 1
45+showdotfiles 0
+1,
-0
1@@ -548,6 +548,7 @@ int editing;
2 int erroutfd;
3 int messagesize; /* negotiated in 9P version setup */
4 int dodollarsigns;
5+int PID;
6 char* mtpt;
7
8 enum
+1,
-1
1@@ -20,7 +20,7 @@ tempfile(void)
2 char buf[128];
3 int i, fd;
4
5- snprint(buf, sizeof buf, "/tmp/X%d.%.4sacme", getpid(), getuser());
6+ snprint(buf, sizeof buf, "/tmp/X%d.%.4sacme", PID, getuser());
7 for(i='A'; i<='Z'; i++){
8 buf[5] = i;
9 if(access(buf, AEXIST) == 0)
+69,
-42
1@@ -6,8 +6,10 @@
2 #include <inttypes.h>
3 #include "parser.h"
4
5+char *home;
6+
7 char
8-*parse_key_value(FILE *file, char const *desired_name)
9+*parsekeyvalue(FILE *file, char const *desired_name, char *def)
10 {
11 char line[256];
12 char name[128];
13@@ -16,7 +18,28 @@ char
14 rewind(file);
15
16 while (fgets(line, sizeof(line), file)) {
17- if (line[0] == '\n' || line[0] == '\0') continue;
18+ if (line[0] == '\n' || line[0] == '\0')
19+ continue;
20+ if (strncmp(line, "@include", 8) == 0) {
21+ char path[256];
22+ char homepath[256];
23+ char *p = line + 8;
24+ while (*p == ' ' || *p == '\t') p++;
25+ strcpy(path, p);
26+ path[strcspn(path, "\n")] = '\0';
27+ FILE *fi = fopen(path, "r");
28+ if (!fi) {
29+ snprintf(homepath, sizeof(homepath), "%s/%s", home, path);
30+ fi = fopen(homepath, "r");
31+ if (!fi) {
32+ fprintf(stderr, "can't open include file from home\n");
33+ exit(1);
34+ }
35+ }
36+ char *found = parsekeyvalue(fi, desired_name, NULL);
37+ fclose(fi);
38+ if (found) return found;
39+ }
40
41 if (sscanf(line, "%127s %127[^\n]", name, val) == 2) {
42 if (strcmp(name, desired_name) == 0) {
43@@ -24,13 +47,13 @@ char
44 }
45 }
46 }
47- return NULL;
48+ return def;
49 }
50
51 uint32_t
52-get_color(FILE *f, char *key, uint32_t def)
53+getcolor(FILE *f, char *key, uint32_t def)
54 {
55- char *temp = parse_key_value(f, key);
56+ char *temp = parsekeyvalue(f, key, NULL);
57 if (!temp)
58 return def;
59 uint32_t color = strtoul(temp, NULL, 16) << 8 | 0xFF;
60@@ -39,10 +62,10 @@ get_color(FILE *f, char *key, uint32_t def)
61 }
62
63 int
64-get_int_value(FILE *f, char *key, int def)
65+getintvalue(FILE *f, char *key, int def)
66 {
67 int result;
68- char *temp = parse_key_value(f, key);
69+ char *temp = parsekeyvalue(f, key, NULL);
70 if (temp == NULL)
71 return def;
72 else
73@@ -52,48 +75,49 @@ get_int_value(FILE *f, char *key, int def)
74 }
75
76 void
77-init_config(void)
78+initconfig(char *custom_config)
79 {
80- char *home = getenv("HOME");
81 char path[1024];
82+
83+ home = getenv("HOME");
84 if (!home) {
85 fprintf(stderr, "$HOME not set\n");
86 exit(1);
87 }
88- snprintf(path, sizeof(path), "%s/.acmerc", home);
89+ if (!custom_config)
90+ snprintf(path, sizeof(path), "%s/.acmerc", home);
91+ else
92+ snprintf(path, sizeof(path), "%s", custom_config);
93 FILE *f = fopen(path, "r");
94 if (!f) {
95 fprintf(stderr, "can't open file\n");
96 exit(1);
97 }
98- ENABLE_PASTELS = get_int_value(f, "pastels", 1);
99- C_MIX = get_color(f, "mix", 0xFFFFFFFF);
100- C_ROOTBG = get_color(f, "root", 0xFFFFFFFF);
101- C_BORDER = get_color(f, "border", 0x000000FF);
102- C_ROWSBG = get_color(f, "rowsbg", 0x000000FF);
103- C_TAGBG = get_color(f, "tagbg", 0x87CEEBFF);
104- C_TAGFG = get_color(f, "tagfg", 0x000000FF);
105- C_TAGHLBG = get_color(f, "htagbg", 0x8FBC8FFF);
106- C_TAGHLFG = get_color(f, "htagfg", 0x000000FF);
107- C_TXTBG = get_color(f, "txtbg", 0xFFFFE0FF);
108- C_TXTFG = get_color(f, "txtfg", 0x000000FF);
109- C_TXTHLBG = get_color(f, "htxtbg", 0x8B8B00FF);
110- C_TXTHLFG = get_color(f, "htxtfg", 0x000000FF);
111- C_WINBUTTON = get_color(f, "winbtn", 0x8A2BE2FF);
112- C_COLBUTTON = get_color(f, "colbtn", 0x8A2BE2FF);
113- C_TMPBUTTON = get_color(f, "tmpbtn", 0x0000CDFF);
114- C_SCROLLBG = get_color(f, "scrlbg", 0x9ACD32FF);
115- C_BUTTON2HL = get_color(f, "btn2hl", 0xAA0000FF);
116- C_BUTTON3HL = get_color(f, "btn3hl", 0x006600FF);
117+ ENABLE_PASTELS = getintvalue(f, "pastels", 1);
118+ C_MIX = getcolor(f, "mix", 0xFFFFFFFF);
119+ C_ROOTBG = getcolor(f, "root", 0xFFFFFFFF);
120+ C_BORDER = getcolor(f, "border", 0x000000FF);
121+ C_TAGBG = getcolor(f, "tagbg", 0xAAFFFFFF);
122+ C_TAGFG = getcolor(f, "tagfg", 0x000000FF);
123+ C_TAGHLBG = getcolor(f, "htagbg", 0x9EEEEEFF);
124+ C_TAGHLFG = getcolor(f, "htagfg", 0x000000FF);
125+ C_TXTBG = getcolor(f, "txtbg", 0xFFFFAAFF);
126+ C_TXTFG = getcolor(f, "txtfg", 0x000000FF);
127+ C_TXTHLBG = getcolor(f, "htxtbg", 0xEEEE9EFF);
128+ C_TXTHLFG = getcolor(f, "htxtfg", 0x000000FF);
129+ C_WINBUTTON = getcolor(f, "winbtn", 0x8888CCFF);
130+ C_COLBUTTON = getcolor(f, "colbtn", 0x8888CCFF);
131+ C_TMPBUTTON = getcolor(f, "tmpbtn", 0x000099FF);
132+ C_SCROLLBG = getcolor(f, "scrlbg", 0x99994CFF);
133+ C_SCROLLFG = getcolor(f, "scrlfg", 0xFFFFAAFF);
134+ C_SCROLLBORDER = getcolor(f, "scrlbord", 0x99994CFF);
135+ C_BUTTON2HL = getcolor(f, "btn2hl", 0xAA0000FF);
136+ C_BUTTON3HL = getcolor(f, "btn3hl", 0x006600FF);
137
138- mainfont = parse_key_value(f, "mainfont");
139- monofont = parse_key_value(f, "monofont");
140- dump_path = parse_key_value(f, "dumppath");
141- acmeshell = parse_key_value(f, "shell");
142- if (!acmeshell || !monofont || !mainfont || !dump_path) {
143- fprintf(stderr, "not all required variables found in config\n");
144- exit(1);
145- }
146+ mainfont = parsekeyvalue(f, "mainfont", "/lib/font/bit/lucsans/euro.8.font");
147+ monofont = parsekeyvalue(f, "monofont", "/lib/font/bit/lucm/unicode.9.font");
148+ dumppath = parsekeyvalue(f, "dumppath", "/tmp/acme.dump");
149+ acmeshell = parsekeyvalue(f, "shell", "/bin/sh");
150
151 if (mainfont) {
152 free(fontnames[0]);
153@@ -104,11 +128,14 @@ init_config(void)
154 fontnames[1] = strdup(monofont);
155 }
156
157- globalautoindent = get_int_value(f, "autoindent", 1);
158- swapscrollbuttons = get_int_value(f, "swpscrllbtns", 0);
159- bartflag = get_int_value(f, "clicktofocus", 1);
160- ncol = get_int_value(f, "colcount", 2);
161- opendir = get_int_value(f, "opendir", 1);
162+ globalautoindent = getintvalue(f, "autoindent", 1);
163+ swapscrollbuttons = getintvalue(f, "swpscrllbtns", 0);
164+ bartflag = getintvalue(f, "clicktofocus", 1);
165+ ncol = getintvalue(f, "colcount", 2);
166+ openarg = getintvalue(f, "openarg", 1);
167+ coolcolbtn = getintvalue(f, "coolcolbtn", 0);
168+ coolscrollbg = getintvalue(f, "coolscrollbg", 0);
169+ showdotfiles = getintvalue(f, "showdotfiles", 1);
170
171 fclose(f);
172 }
+11,
-5
1@@ -1,8 +1,8 @@
2 #include <stdio.h>
3
4-char *parse_key_value(FILE *file, char const *desired_name);
5-uint32_t get_color(FILE *f, char *key, uint32_t def);
6-void init_config(void);
7+char *parsekeyvalue(FILE *file, char const *desired_name, char *def);
8+uint32_t getcolor(FILE *f, char *key, uint32_t def);
9+void initconfig(char *custom_config_path);
10
11 int ENABLE_PASTELS;
12 uint32_t C_MIX;
13@@ -21,18 +21,24 @@ uint32_t C_WINBUTTON;
14 uint32_t C_COLBUTTON;
15 uint32_t C_TMPBUTTON;
16 uint32_t C_SCROLLBG;
17+uint32_t C_SCROLLFG;
18+uint32_t C_SCROLLBORDER;
19 uint32_t C_BUTTON2HL;
20 uint32_t C_BUTTON3HL;
21
22 char *mainfont;
23 char *monofont;
24 char *fontnames[2];
25-char *dump_path;
26+char *dumppath;
27 char *acmeshell;
28+char *customconfigpath;
29
30 int globalautoindent;
31 int bartflag;
32 int swapscrollbuttons;
33 int ncol;
34-int opendir;
35+int openarg;
36+int coolcolbtn;
37+int coolscrollbg;
38+int showdotfiles;
39
+3,
-3
1@@ -338,7 +338,7 @@ rowdump(Row *row, char *file)
2 warning(nil, "can't find file for dump: $home not defined\n");
3 goto Rescue;
4 }
5- sprint(buf, "%s", dump_path);
6+ sprint(buf, "%s", dumppath);
7 file = buf;
8 }
9 fd = create(file, OWRITE, 0600);
10@@ -536,7 +536,7 @@ rowload(Row *row, char *file, int initing)
11 warning(nil, "can't find file for load: $home not defined\n");
12 goto Rescue1;
13 }
14- sprint(buf, "%s", dump_path);
15+ sprint(buf, "%s", dumppath);
16 file = buf;
17 }
18 b = Bopen(file, OREAD);
19@@ -739,7 +739,7 @@ rowload(Row *row, char *file, int initing)
20 textinsert(&w->tag, w->tag.file->b.nc, r+n+1, nr-(n+1), TRUE);
21 if(ndumped >= 0){
22 /* simplest thing is to put it in a file and load that */
23- sprint(buf, "/tmp/d%d.%.4sacme", getpid(), getuser());
24+ sprint(buf, "/tmp/d%d.%.4sacme", PID, getuser());
25 fd = create(buf, OWRITE, 0600);
26 if(fd < 0){
27 free(r);
+9,
-2
1@@ -11,8 +11,11 @@
2 #include <libsec.h>
3 #include "dat.h"
4 #include "fns.h"
5+#include "parser.h"
6
7 static Image *scrtmp;
8+Image *scrollfg;
9+Image *scrollborder;
10
11 static
12 Rectangle
13@@ -70,10 +73,14 @@ textscrdraw(Text *t)
14 r2 = scrpos(r1, t->org, t->org+t->fr.nchars, t->file->b.nc);
15 if(!eqrect(r2, t->lastsr)){
16 t->lastsr = r2;
17+ if(scrollfg == nil) {
18+ scrollfg = allocimage(display, Rect(0,0,1,1), RGBA32, 1, C_SCROLLFG);
19+ scrollborder = allocimage(display, Rect(0,0,1,1), RGBA32, 1, C_SCROLLBORDER);
20+ }
21 draw(b, r1, t->fr.cols[BORD], nil, ZP);
22- draw(b, r2, t->fr.cols[BACK], nil, ZP);
23+ draw(b, r2, scrollfg, nil, ZP);
24 r2.min.x = r2.max.x-1;
25- draw(b, r2, t->fr.cols[BORD], nil, ZP);
26+ draw(b, r2, scrollborder, nil, ZP);
27 draw(t->fr.b, r, b, nil, Pt(0, r1.min.y));
28 /*flushimage(display, 1); // BUG? */
29 }
+8,
-6
1@@ -12,6 +12,7 @@
2 #include <complete.h>
3 #include "dat.h"
4 #include "fns.h"
5+#include "parser.h"
6
7 Image *tagcols[NCOL];
8 Image *textcols[NCOL];
9@@ -243,6 +244,11 @@ textload(Text *t, uint q0, char *file, int setqid)
10 dbuf = nil;
11 while((n=dirread(fd, &dbuf)) > 0){
12 for(i=0; i<n; i++){
13+ if (!showdotfiles) {
14+ if (dbuf[i].name[0] == '.') {
15+ continue;
16+ }
17+ }
18 dl = emalloc(sizeof(Dirlist));
19 j = strlen(dbuf[i].name);
20 tmp = emalloc(j+1+1);
21@@ -682,13 +688,11 @@ texttype(Text *t, Rune r)
22 rp = &r;
23 switch(r){
24 case Kleft:
25- case 0x02: /* Ctrl + B */
26 typecommit(t);
27 if(t->q0 > 0)
28 textshow(t, t->q0-1, t->q0-1, TRUE);
29 return;
30 case Kright:
31- case 0x06: /* Ctrl+F */
32 typecommit(t);
33 if(t->q1 < t->file->b.nc)
34 textshow(t, t->q1+1, t->q1+1, TRUE);
35@@ -724,7 +728,6 @@ texttype(Text *t, Rune r)
36 */
37
38 case Kdown:
39- case 0x0E: /* Ctrl+N */
40 if(t->what == Tag)
41 goto Tagdown;
42 typecommit(t);
43@@ -754,7 +757,6 @@ texttype(Text *t, Rune r)
44 textshow(t, q0, q0, TRUE);
45 return;
46 case Kup:
47- case 0x10: /* Ctrl+P */
48 if(t->what == Tag)
49 goto Tagup;
50 typecommit(t);
51@@ -935,7 +937,7 @@ texttype(Text *t, Rune r)
52
53 switch(r){
54 case Kins:
55- case 0x04:
56+ case 0x06:
57 typecommit(t);
58 rp = textcomplete(t);
59 if(rp == nil)
60@@ -959,7 +961,7 @@ texttype(Text *t, Rune r)
61 * apparently it works like ^U and erases whole lines. i should learn c
62 */
63
64- case 0x02:
65+ case 0x0C:
66 typecommit(t);
67 q0 = 0;
68 q1 = t->file->b.nc;