[9fans] drawterm problems after susupdate

2023-02-20 Thread fijal
After sysupdate (+ mk install, new kernel) drawterm wich I used does not work 
anymore with message:  waiting for FS: i/o on hangup channel.
Till update worked like a charm.
Any ideas?
Thanks
fijal

PS
Drawterm on void linux, 9front on kvm.

--
9fans: 9fans
Permalink: 
https://9fans.topicbox.com/groups/9fans/Te0c7fa564759b89c-M713423b74c30b38e6e29813a
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription


[9fans] Acme: support spaces in file|dir names

2023-02-20 Thread adr

Hi,

this patch adds code from p9p to support spaces in file or dir
names. I use the 9front version because it has been mantained, but
there are more fixes in p9p to be imported.

adr
diff -Nur /n/9front/sys/src/cmd/acme/fns.h /sys/src/cmd/acme/fns.h
--- /n/9front/sys/src/cmd/acme/fns.hMon Jul 11 20:01:08 2022
+++ /sys/src/cmd/acme/fns.h Mon Feb 20 15:23:42 2023
@@ -90,6 +90,7 @@
 void  flushwarnings(void);
 long  nlcount(Text*, long, long, long*);
 long  nlcounttopos(Text*, long, long, long);
+Rune*  parsetag(Window*, int, int*);

 #define   runemalloc(a)   (Rune*)emalloc((a)*sizeof(Rune))
 #define   runerealloc(a, b)   (Rune*)erealloc((a), (b)*sizeof(Rune))
diff -Nur /n/9front/sys/src/cmd/acme/look.c /sys/src/cmd/acme/look.c
--- /n/9front/sys/src/cmd/acme/look.c   Mon Jul 11 20:01:08 2022
+++ /sys/src/cmd/acme/look.cMon Feb 20 15:47:24 2023
@@ -397,9 +397,9 @@
 Runestr
 dirname(Text *t, Rune *r, int n)
 {
-   Rune *b, c;
-   uint m, nt;
-   int slash;
+   Rune *b;
+   uint nt;
+   int slash, i;
   Runestr tmp;

   b = nil;
@@ -410,15 +410,13 @@
   goto Rescue;
   if(n>=1 && r[0]=='/')
   goto Rescue;
-   b = runemalloc(nt+n+1);
-   bufread(t->w->tag.file, 0, b, nt);
+   b = parsetag(t->w, n, );
   slash = -1;
-   for(m=0; m= 0; i--){
+   if(b[i] == '/'){
+   slash = i;
   break;
+   }
   }
   if(slash < 0)
   goto Rescue;
@@ -502,7 +500,7 @@
   if(nname == -1)
   nname = n;
   for(i=0; i, and turn that into an include
diff -Nur /n/9front/sys/src/cmd/acme/wind.c /sys/src/cmd/acme/wind.c
--- /n/9front/sys/src/cmd/acme/wind.c   Mon Jul 11 20:01:08 2022
+++ /sys/src/cmd/acme/wind.cMon Feb 20 15:20:37 2023
@@ -109,14 +109,26 @@
   return rr - r;
 }

+int
+delrunepos(Window *w)
+{
+   Rune *r;
+   int i;
+
+   r = parsetag(w, 0, );
+   free(r);
+   i += 2;
+   if(i >= w->tag.file->nc)
+   return -1;
+   return i;
+}
+
 void
 movetodel(Window *w)
 {
   int n;
- 
-   n = tagrunepos(w, delcmd);

-   free(delcmd);
-   delcmd = nil;
+
+   n = delrunepos(w);
   if(n < 0)
   return;
   moveto(mousectl, addpt(frptofchar(>tag, n), Pt(4, 
w->tag.font->height-4)));
@@ -141,7 +153,7 @@

   if(!w->tagexpand) {
   /* use just as many lines as needed to show the Del */
-   n = tagrunepos(w, delcmd);
+   n = delrunepos(w);
   if(n < 0)
   return 1;
   p = subpt(frptofchar(>tag, n), w->tag.r.min);
@@ -412,11 +424,7 @@

   /* w must be committed */
   n = w->tag.file->nc;
-   r = runemalloc(n);
-   bufread(w->tag.file, 0, r, n);
-   for(i=0; itag, w->tag.q0, w->tag.q1);
 }

+Rune*
+parsetag(Window *w, int extra, int *len)
+{
+   static Rune Ldelsnarf[] = { ' ', 'D', 'e', 'l', ' ', 'S', 'n', 'a', 
'r', 'f', 0 };
+   static Rune Lspacepipe[] = { ' ', '|', 0 };
+   static Rune Ltabpipe[] = { '\t', '|', 0 };
+   int i;
+   Rune *r, *p, *pipe;
+
+   r = runemalloc(w->tag.file->nc+extra+1);
+   bufread(w->tag.file, 0, r, w->tag.file->nc);
+   r[w->tag.file->nc] = '\0';
+
+   /*
+* " |" or "\t|" ends left half of tag
+* If we find " Del Snarf" in the left half of the tag
+* (before the pipe), that ends the file name.
+*/
+   pipe = runestrstr(r, Lspacepipe);
+   if((p = runestrstr(r, Ltabpipe)) != nil && (pipe == nil || p < pipe))
+   pipe = p;
+   if((p = runestrstr(r, Ldelsnarf)) != nil && (pipe == nil || p < pipe))
+   i = p - r;
+   else {
+   for(i=0; itag.file->nc; i++)
+   if(r[i]==' ' || r[i]=='\t')
+   break;
+   }
+   *len = i;
+   return r;
+}
+
 void
 winsettag1(Window *w)
 {
@@ -445,12 +485,7 @@
   /* there are races that get us here with stuff in the tag cache, so we 
take extra care to sync it */
   if(w->tag.ncache!=0 || w->tag.file->mod)
   wincommit(w, >tag);  /* check file name; also guarantees we 
can modify tag contents */
-   old = runemalloc(w->tag.file->nc+1);
-   bufread(w->tag.file, 0, old, w->tag.file->nc);
-   old[w->tag.file->nc] = '\0';
-   for(i=0; itag.file->nc; i++)
-   if(old[i]==' ' || old[i]=='\t')
-   break;
+   old = parsetag(w, 0, );
   if(runeeq(old, i, w->body.file->name, w->body.file->nname) == FALSE){
   textdelete(>tag, 0, i, TRUE);
   textinsert(>tag, 0, w->body.file->name, w->body.file->nname, 
TRUE);
@@ -458,7 +493,6 @@
   old = runemalloc(w->tag.file->nc+1);
   bufread(w->tag.file, 0, old, w->tag.file->nc);
   old[w->tag.file->nc] = '\0';
-   w->tagsafe = 

Re: [9fans] Acme: support spaces in file|dir names

2023-02-20 Thread hiro
9front has a p9p version? i was not aware... can you link to it?

On 2/20/23, adr  wrote:
> Hi,
> 
> this patch adds code from p9p to support spaces in file or dir
> names. I use the 9front version because it has been mantained, but
> there are more fixes in p9p to be imported.
> 
> adr
> diff -Nur /n/9front/sys/src/cmd/acme/fns.h /sys/src/cmd/acme/fns.h
> --- /n/9front/sys/src/cmd/acme/fns.hMon Jul 11 20:01:08 2022
> +++ /sys/src/cmd/acme/fns.h Mon Feb 20 15:23:42 2023
> @@ -90,6 +90,7 @@
>   void  flushwarnings(void);
>   long  nlcount(Text*, long, long, long*);
>   long  nlcounttopos(Text*, long, long, long);
> +Rune*  parsetag(Window*, int, int*);
> 
> #define   runemalloc(a)   (Rune*)emalloc((a)*sizeof(Rune))
> #define   runerealloc(a, b)   (Rune*)erealloc((a),
> (b)*sizeof(Rune))
> diff -Nur /n/9front/sys/src/cmd/acme/look.c /sys/src/cmd/acme/look.c
> --- /n/9front/sys/src/cmd/acme/look.c   Mon Jul 11 20:01:08 2022
> +++ /sys/src/cmd/acme/look.cMon Feb 20 15:47:24 2023
> @@ -397,9 +397,9 @@
> Runestr
> dirname(Text *t, Rune *r, int n)
> {
> -   Rune *b, c;
> -   uint m, nt;
> -   int slash;
> +   Rune *b;
> +   uint nt;
> +   int slash, i;
>   Runestr tmp;
> 
> b = nil;
> @@ -410,15 +410,13 @@
> goto Rescue;
> if(n>=1 && r[0]=='/')
> goto Rescue;
> -   b = runemalloc(nt+n+1);
> -   bufread(t->w->tag.file, 0, b, nt);
> +   b = parsetag(t->w, n, );
> slash = -1;
> -   for(m=0; m -   c = b[m];
> -   if(c == '/')
> -   slash = m;
> -   if(c==' ' || c=='\t')
> +   for(i--; i >= 0; i--){
> +   if(b[i] == '/'){
> +   slash = i;
> break;
> +   }
> }
> if(slash < 0)
> goto Rescue;
> @@ -502,7 +500,7 @@
> if(nname == -1)
> nname = n;
> for(i=0; i -   if(!isfilec(r[i]))
> +   if(!isfilec(r[i]) && r[i] != ' ')
> goto Isntfile;
> /*
>  * See if it's a file name in <>, and turn that into an include
> diff -Nur /n/9front/sys/src/cmd/acme/wind.c /sys/src/cmd/acme/wind.c
> --- /n/9front/sys/src/cmd/acme/wind.c   Mon Jul 11 20:01:08 2022
> +++ /sys/src/cmd/acme/wind.cMon Feb 20 15:20:37 2023
> @@ -109,14 +109,26 @@
> return rr - r;
> }
> 
> +int
> +delrunepos(Window *w)
> +{
> +   Rune *r;
> +   int i;
> +
> +   r = parsetag(w, 0, );
> +   free(r);
> +   i += 2;
> +   if(i >= w->tag.file->nc)
> +   return -1;
> +   return i;
> +}
> +
>   void
>   movetodel(Window *w)
>   {
> int n;
> -
> -   n = tagrunepos(w, delcmd);
> -   free(delcmd);
> -   delcmd = nil;
> +
> +   n = delrunepos(w);
> if(n < 0)
> return;
> moveto(mousectl, addpt(frptofchar(>tag, n), Pt(4,
> w->tag.font->height-4)));
> @@ -141,7 +153,7 @@
> 
> if(!w->tagexpand) {
> /* use just as many lines as needed to show the Del */
> -   n = tagrunepos(w, delcmd);
> +   n = delrunepos(w);
> if(n < 0)
> return 1;
> p = subpt(frptofchar(>tag, n), w->tag.r.min);
> @@ -412,11 +424,7 @@
> 
> /* w must be committed */
> n = w->tag.file->nc;
> -   r = runemalloc(n);
> -   bufread(w->tag.file, 0, r, n);
> -   for(i=0; i -   if(r[i]==' ' || r[i]=='\t')
> -   break;
> +   r = parsetag(w, 0, );
> for(; i if(r[i] == '|')
> break;
> @@ -433,6 +441,38 @@
> textsetselect(>tag, w->tag.q0, w->tag.q1);
> }
> 
> +Rune*
> +parsetag(Window *w, int extra, int *len)
> +{
> +   static Rune Ldelsnarf[] = { ' ', 'D', 'e', 'l', ' ', 'S', 'n', 'a',
> 'r', 'f', 0 };
> +   static Rune Lspacepipe[] = { ' ', '|', 0 };
> +   static Rune Ltabpipe[] = { '\t', '|', 0 };
> +   int i;
> +   Rune *r, *p, *pipe;
> +
> +   r = runemalloc(w->tag.file->nc+extra+1);
> +   bufread(w->tag.file, 0, r, w->tag.file->nc);
> +   r[w->tag.file->nc] = '\0';
> +
> +   /*
> +* " |" or "\t|" ends left half of tag
> +* If we find " Del Snarf" in the left half of the tag
> +* (before the pipe), that ends the file name.
> +*/
> +   pipe = runestrstr(r, Lspacepipe);
> +   if((p = runestrstr(r, Ltabpipe)) != nil && (pipe == nil || p <
> pipe))
> +   pipe = p;
> +   if((p = runestrstr(r, Ldelsnarf)) != nil && (pipe == nil || p <
> pipe))
> +   i = p - r;
> +   else {
> +   for(i=0; itag.file->nc; i++)
> +   if(r[i]==' ' || r[i]=='\t')
> +   break;
> +   }
> +   *len = i;
> +   return r;
> +}
> +
>   void
>   winsettag1(Window *w)
>   {
> @@ -445,12 +485,7 @@
> /* there are races that get us here with stuff in the tag cache, so
> we take extra care to sync it */
> if(w->tag.ncache!=0 || w->tag.file->mod)
> 

Re: [9fans] Acme: support spaces in file|dir names

2023-02-20 Thread hiro
> Sorry hiro, I mean that I imported the acme version of 9front to
> my system (based on 9legacy) because it has been updated along the
> plan9port repo.

h, sorry for missing the other direction :D

> One thing I can't understand is why the text window
> is always redrawn completely when the tag line is edited.

yeah, i heard about that one, it's a bit surprising that's still not fixed.
but many people use just sam on 9front and never notice such things.
my memory of acme is fading :)

> Anyway, I remember seeing a version of plan9port with the apps from
> 9front somewhere, I'm surprised you didn't know about it.

yeah in fact i wanted to make sure you don't use that one, bec. really
it never got much care and 9fans/p9p was always it's upstream.

otherwise, i guess there's also the inferno version of acme (i am a
former acme-sac user).

--
9fans: 9fans
Permalink: 
https://9fans.topicbox.com/groups/9fans/Tc1d9d9ca3a94e285-M40d76eccd7f7ae74ec0ac0b0
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription


Re: [9fans] Acme: support spaces in file|dir names

2023-02-20 Thread adr

On Mon, 20 Feb 2023, hiro wrote:

9front has a p9p version? i was not aware... can you link to it?


Sorry hiro, I mean that I imported the acme version of 9front to
my system (based on 9legacy) because it has been updated along the
plan9port repo. But there are more fixes and improvements that
could be imported (to 9front's acme) from plan9port. This patch
makes 9front's acme able to open files and dirs with spaces in
their names. One thing I can't understand is why the text window
is always redrawn completely when the tag line is edited. I'll take a look
in the future.

Anyway, I remember seeing a version of plan9port with the apps from
9front somewhere, I'm surprised you didn't know about it.

adr.

--
9fans: 9fans
Permalink: 
https://9fans.topicbox.com/groups/9fans/Tc1d9d9ca3a94e285-M5b0a4879bb3a257cf8f7ebd4
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription