From fa325e9b42b0bdfb48857d1958d9fb7ceac55151 Mon Sep 17 00:00:00 2001 From: Dan Cross Date: Fri, 10 Jan 2020 14:44:21 +0000 Subject: Trivial changes: whitespace and modes. Remote whitespace at the ends of lines. Remove blank lines from the ends of files. Change modes on source files so that they are not executable. Signed-off-by: Dan Cross --- src/cmd/acme/ecmd.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/cmd/acme/ecmd.c') diff --git a/src/cmd/acme/ecmd.c b/src/cmd/acme/ecmd.c index ef92e339..75cf710f 100644 --- a/src/cmd/acme/ecmd.c +++ b/src/cmd/acme/ecmd.c @@ -633,8 +633,8 @@ runpipe(Text *t, int cmd, Rune *cr, int ncr, int state) /* * The editoutlk exists only so that we can tell when * the editout file has been closed. It can get closed *after* - * the process exits because, since the process cannot be - * connected directly to editout (no 9P kernel support), + * the process exits because, since the process cannot be + * connected directly to editout (no 9P kernel support), * the process is actually connected to a pipe to another * process (arranged via 9pserve) that reads from the pipe * and then writes the data in the pipe to editout using @@ -704,7 +704,7 @@ printposn(Text *t, int mode) if (t != nil && t->file != nil && t->file->name != nil) warning(nil, "%.*S:", t->file->nname, t->file->name); - + switch(mode) { case PosnChars: warning(nil, "#%d", addr.r.q0); @@ -712,7 +712,7 @@ printposn(Text *t, int mode) warning(nil, ",#%d", addr.r.q1); warning(nil, "\n"); return; - + default: case PosnLine: l1 = 1+nlcount(t, 0, addr.r.q0, nil); -- cgit v1.2.3 From d2df5d6cbd345e101732fe7d22bb5b3baa5fb61a Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Mon, 13 Jan 2020 18:15:57 -0500 Subject: acme: fix crash in X |cat with multiple windows Fixes #9. Fixes #219. Fixes #222. Fixes #330. --- src/cmd/acme/ecmd.c | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) (limited to 'src/cmd/acme/ecmd.c') diff --git a/src/cmd/acme/ecmd.c b/src/cmd/acme/ecmd.c index 75cf710f..f7613172 100644 --- a/src/cmd/acme/ecmd.c +++ b/src/cmd/acme/ecmd.c @@ -28,7 +28,7 @@ int append(File*, Cmd*, long); int pdisplay(File*); void pfilename(File*); void looper(File*, Cmd*, int); -void filelooper(Cmd*, int); +void filelooper(Text*, Cmd*, int); void linelooper(File*, Cmd*); Address lineaddr(long, Address, int); int filematch(File*, String*); @@ -584,7 +584,7 @@ X_cmd(Text *t, Cmd *cp) { USED(t); - filelooper(cp, cp->cmdc=='X'); + filelooper(t, cp, cp->cmdc=='X'); return TRUE; } @@ -978,9 +978,10 @@ alllocker(Window *w, void *v) } void -filelooper(Cmd *cp, int XY) +filelooper(Text *t, Cmd *cp, int XY) { int i; + Text *targ; if(Glooping++) editerror("can't nest %c command", "YX"[XY]); @@ -1001,8 +1002,26 @@ filelooper(Cmd *cp, int XY) */ allwindows(alllocker, (void*)1); globalincref = 1; - for(i=0; ibody, cp->u.cmd); + + /* + * Unlock the window running the X command. + * We'll need to lock and unlock each target window in turn. + */ + if(t && t->w) + winunlock(t->w); + + for(i=0; ibody; + if(targ && targ->w) + winlock(targ->w, cp->cmdc); + cmdexec(targ, cp->u.cmd); + if(targ && targ->w) + winunlock(targ->w); + } + + if(t && t->w) + winlock(t->w, cp->cmdc); + allwindows(alllocker, (void*)0); globalincref = 0; free(loopstruct.w); -- cgit v1.2.3