]> git.neil.brown.name Git - edlib.git/commitdiff
Allow Notify:Close to work for docs being closed.
authorNeilBrown <neil@brown.name>
Wed, 13 Sep 2023 22:37:20 +0000 (08:37 +1000)
committerNeilBrown <neil@brown.name>
Fri, 15 Sep 2023 03:03:14 +0000 (13:03 +1000)
When a doc is closed we need to allow some notifications.
Remove the Close:Notify hack and use Notify:Close with the
target commands defined with DEF_CMD_CLOSED().

Signed-off-by: NeilBrown <neil@brown.name>
core-doc.c
core-pane.c
core-pane.h

index 1e154290ab8f64a3bcb55fe6ef9aaa41be861d22..31b4549208c8f74749b92d7700ac6ed1ae3a7aa7 100644 (file)
@@ -732,10 +732,7 @@ DEF_CMD(doc_addview)
        if (d->views /* FIXME always true */) {
                points_attach(d, ret);
                d->views[ret].owner = ci->focus;
-               /* Use Close:Notify because we need this even
-                * when the pane is closing
-                */
-               pane_add_notify(ci->home, ci->focus, "Close:Notify");
+               pane_add_notify(ci->home, ci->focus, "Notify:Close");
        }
        return 1 + ret;
 }
@@ -747,7 +744,7 @@ DEF_CMD(doc_close_doc)
        return 1;
 }
 
-DEF_CMD(doc_view_close)
+DEF_CMD_CLOSED(doc_view_close)
 {
        /* A pane which once held a view is closing.  We must discard
         * that view if it still exists.
@@ -1334,7 +1331,7 @@ static void init_doc_cmds(void)
 
        key_add(doc_default_cmd, "doc:add-view", &doc_addview);
        key_add(doc_default_cmd, "doc:del-view", &doc_delview);
-       key_add(doc_default_cmd, "Close:Notify", &doc_view_close);
+       key_add(doc_default_cmd, "Notify:Close", &doc_view_close);
        key_add(doc_default_cmd, "doc:vmark-get", &doc_vmarkget);
        key_add(doc_default_cmd, "doc:vmark-prev", &doc_vmarkprev);
        key_add(doc_default_cmd, "doc:vmark-new", &doc_vmarknew);
index f8ff319aeb45457c07b31a24bf464027d72176c2..4e2932cddf45403fac5b8c3f3b90e26eeb6e7216 100644 (file)
@@ -489,11 +489,6 @@ static void pane_notify_close(struct pane *p safe)
                list_del_init(&n->notifier_link);
                if (strcmp(n->notification, "Notify:Close") == 0)
                        pane_call(n->notifiee, n->notification, p);
-               /* Close:Notify can be delivered even to DAMAGED_CLOSED
-                * panes
-                */
-               if (strcmp(n->notification, "Close:Notify") == 0)
-                       pane_call(n->notifiee, n->notification, p);
                free(n->notification);
                free(n);
        }
index ebc27fa0ae474d0860ca7e1da151e15c1c5d5b52..65a43ff3ecb7080c62ec997ee126faa0428f7658 100644 (file)
@@ -138,7 +138,7 @@ static inline int do_call_val(enum target_type type, struct pane *home,
                                         */
                    strncmp(ci.key, "Close", 5) != 0)
                        /* This pane cannot accept anything but
-                        * "Close" or "Close:mark" or "Close:Notify"
+                        * "Close" or "Close:mark".
                         */
                        return Efallthrough;
                ci.comm = home->handle;