* movetodel function in acme not called
@ 2018-02-13 10:02 Tobias Heinicke
2018-02-13 10:59 ` [9front] " Ethan Grammatikidis
0 siblings, 1 reply; 2+ messages in thread
From: Tobias Heinicke @ 2018-02-13 10:02 UTC (permalink / raw)
To: 9front
[-- Attachment #1.1.1: Type: text/plain, Size: 1373 bytes --]
Hi,
first of all I would like to thank you for developing 9front and thus
keeping plan9 alive and kicking.
I was just wondering whether there is a reason for movetodel() being
committed, without being ever used. The function was added in p9p as
part of rsc's effort to allow deleting several acme windows in a column
without having to move the mouse pointer (committed on 2012-09-23 -
37f8ed2410ad5cbd46eda00a77f8bf4950bcf544).
In 9front the function definition was added on 2013-08-29 (Node ID:
3af7b07be732a15a30e323134f8056986ca4e0ed), but the code to call it is
missing (and thus deleting a sequence of windows in 9front's acme still
requires moving the mouse a lot).
So far I have recursively grep'd the mail archives for 'movetodel', but
have not found anything. If the behaviour implemented by rsc is
desirable I suggest adding it.
Attached is a diff of the code that is missing for rsc's feature to be
available in 9front's acme (created using hg diff, if you would rather
like to see a patch (e.g. committing the changes and hg export or
sth.?), feel free to tell me). Sorry for probably not complying to any
rules, as I am fairly new to using 9front (and been lurking this mailing
list even less [- subscribed with a different address]).
Best regards,
Tobias Heinicke
P.S.: Sorry for my English, I am not a native speaker.
[-- Attachment #1.1.2: utilizeMovetodelDiff --]
[-- Type: text/plain, Size: 2001 bytes --]
diff -r 0b97536e2bcd sys/src/cmd/acme/cols.c
--- a/sys/src/cmd/acme/cols.c Mon Feb 05 19:16:29 2018 +0100
+++ b/sys/src/cmd/acme/cols.c Tue Feb 13 08:45:51 2018 +0100
@@ -111,7 +111,7 @@
colclose(Column *c, Window *w, int dofree)
{
Rectangle r;
- int i;
+ int i, didmouse, up;
/* w is locked */
if(!c->safe)
@@ -125,7 +125,7 @@
w->tag.col = nil;
w->body.col = nil;
w->col = nil;
- restoremouse(w);
+ didmouse = restoremouse(w);
if(dofree){
windelete(w);
winclose(w);
@@ -137,17 +137,24 @@
draw(screen, r, display->white, nil, ZP);
return;
}
+ up = 0;
if(i == c->nw){ /* extend last window down */
w = c->w[i-1];
r.min.y = w->r.min.y;
r.max.y = c->r.max.y;
}else{ /* extend next window up */
+ up = 1;
w = c->w[i];
r.max.y = w->r.max.y;
}
draw(screen, r, textcols[BACK], nil, ZP);
- if(c->safe)
+ if(c->safe) {
+ if(!didmouse && up)
+ w->showdel = TRUE;
winresize(w, r, FALSE);
+ if(!didmouse && up)
+ movetodel(w);
+ }
}
void
diff -r 0b97536e2bcd sys/src/cmd/acme/fns.h
--- a/sys/src/cmd/acme/fns.h Mon Feb 05 19:16:29 2018 +0100
+++ b/sys/src/cmd/acme/fns.h Tue Feb 13 08:45:51 2018 +0100
@@ -19,10 +19,11 @@
char* getname(Text*, Text*, Rune*, int, int);
void scrsleep(uint);
void savemouse(Window*);
-void restoremouse(Window*);
+int restoremouse(Window*);
void clearmouse(void);
void allwindows(void(*)(Window*, void*), void*);
uint loadfile(int, uint, int*, int(*)(void*, uint, Rune*, int), void*);
+void movetodel(Window*);
Window* errorwin(Mntdir*, int);
Window* errorwinforwin(Window*);
diff -r 0b97536e2bcd sys/src/cmd/acme/util.c
--- a/sys/src/cmd/acme/util.c Mon Feb 05 19:16:29 2018 +0100
+++ b/sys/src/cmd/acme/util.c Tue Feb 13 08:45:51 2018 +0100
@@ -366,12 +366,18 @@
mousew = w;
}
-void
+int
restoremouse(Window *w)
{
- if(mousew!=nil && mousew==w)
+ int did;
+
+ did = 0;
+ if(mousew!=nil && mousew==w) {
moveto(mousectl, prevmouse);
+ did = 1;
+ }
mousew = nil;
+ return did;
}
void
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 516 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [9front] movetodel function in acme not called
2018-02-13 10:02 movetodel function in acme not called Tobias Heinicke
@ 2018-02-13 10:59 ` Ethan Grammatikidis
0 siblings, 0 replies; 2+ messages in thread
From: Ethan Grammatikidis @ 2018-02-13 10:59 UTC (permalink / raw)
To: 9front
On Tue, Feb 13, 2018, at 10:02 AM, Tobias Heinicke wrote:
>
> If the behaviour implemented by rsc is
> desirable I suggest adding it.
speaking as an acme user, the behaviour is somewhat
desirable. it's one of a myriad tweaks which mitigate the
discomfort caused by acme's window system design.
as might be obvious from my tone, i'm only using acme
until i can find or (preferably) write another editor i can
tolerate. still, if anyone is in the mood for fixing acme,
there's also something wrong with the X command.
(probably Y too.)
someone, in some mailing list, (i'm very sorry for the
vagueness,) writing about acme on inferno,
found a variable pertaining to the X command
could be used uninitialized. i took notice because
i've developed a certain amount of fear of using the
X command in acme on 9front. strange things may
happen during or after using it, including sudden exits
and freezes without any apparent cause.
again, i'm sorry for the vagueness. i didn't save the
inferno mail because i was going through a hard time,
and i don't want to look at acme's source because i'm
still struggling with my code-reading skills.
--
The lyf so short, the craft so long to lerne. -- Chaucer
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-02-13 10:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-13 10:02 movetodel function in acme not called Tobias Heinicke
2018-02-13 10:59 ` [9front] " Ethan Grammatikidis
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).