]> git.neil.brown.name Git - edlib.git/commitdiff
Introduce PANE_DATA_PTR_TYPE_3 for emacs-search.
authorNeilBrown <neil@brown.name>
Thu, 14 Sep 2023 10:19:23 +0000 (20:19 +1000)
committerNeilBrown <neil@brown.name>
Fri, 15 Sep 2023 03:38:14 +0000 (13:38 +1000)
Emacs-search has 2 pane types, one is a ptr type.

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

index c466f5ac7ba8b8c86601ef8fae74e6c4b400e341..373bad4424c8b06e544e8ee9a439631ae63dc2a4 100644 (file)
@@ -42,6 +42,12 @@ struct pane {
 #endif
 #ifdef PANE_DATA_PTR_TYPE_2
                PANE_DATA_PTR_TYPE_2 data2 safe;
+#endif
+#ifdef PANE_DATA_TYPE_3
+               PANE_DATA_TYPE_3 data3[1];
+#endif
+#ifdef PANE_DATA_PTR_TYPE_3
+               PANE_DATA_PTR_TYPE_3 data3 safe;
 #endif
                void            *_data safe;
        };
diff --git a/core.h b/core.h
index 3a8b5835340dc2629274c264a6d658329f1a7c92..9a18a7e66feaeb05d2f2178b8acee8b6283a6786 100644 (file)
--- a/core.h
+++ b/core.h
@@ -488,6 +488,18 @@ static inline struct pane *pane_register_2(struct pane *parent safe, short z,
 }
 #endif
 
+#ifdef PANE_DATA_TYPE_3
+#define pane_register_3(p,z,h) do_pane_register(p,z,h,NULL, sizeof(PANE_DATA_TYPE_3))
+#endif
+#ifdef PANE_DATA_PTR_TYPE_3
+static inline struct pane *pane_register_3(struct pane *parent safe, short z,
+                                          struct command *handle safe,
+                                          PANE_DATA_PTR_TYPE_3 data)
+{
+       return do_pane_register(parent, z, handle, (void*)data, sizeof(data));
+}
+#endif
+
 void pane_update_handle(struct pane *p safe, struct command *handle safe);
 
 
index 22b5b2ba039e149b3d4a7becdda9d830690f33f5..83a660a403a76657f80cc98d8036ae8df54e9cd7 100644 (file)
@@ -26,6 +26,7 @@
 #include <string.h>
 #define PANE_DATA_TYPE struct es_info
 #define PANE_DATA_TYPE_2 struct highlight_info
+#define PANE_DATA_PTR_TYPE_3 struct pane *
 #include "core.h"
 #include "rexel.h"
 
@@ -477,7 +478,7 @@ DEF_CMD(search_replace)
        attr_set_str(&p->attrs, "status-line", " Replacement ");
        call("doc:set-name", p, 0, NULL, "Replacement");
 
-       p = pane_register(p, 0, &replace_handle.c, ci->focus);
+       p = pane_register_3(p, 0, &replace_handle.c, ci->focus);
        if (!p)
                return Efail;
        p = call_ret(pane, "attach-history", p, 0, NULL, "*Replace History*");
@@ -563,7 +564,7 @@ DEF_CMD(do_replace)
 
 DEF_CMD(replace_request_next)
 {
-       struct pane *sp = ci->home->_data;
+       struct pane *sp = ci->home->data3;
        char *new;
 
        new = call_ret(str, "doc:get-str", ci->focus);
@@ -578,7 +579,7 @@ DEF_CMD(replace_request_next)
 
 DEF_CMD(replace_request)
 {
-       struct pane *sp = ci->home->_data;
+       struct pane *sp = ci->home->data3;
        char *new;
 
        new = call_ret(str, "doc:get-str", ci->focus);
@@ -590,7 +591,7 @@ DEF_CMD(replace_request)
 
 DEF_CMD(replace_all)
 {
-       struct pane *sp = ci->home->_data;
+       struct pane *sp = ci->home->data3;
        char *new;
        int replaced = 0;
 
@@ -609,7 +610,7 @@ DEF_CMD(replace_all)
 
 DEF_CMD(replace_to_search)
 {
-       struct pane *sp = ci->home->_data;
+       struct pane *sp = ci->home->data3;
 
        pane_take_focus(sp);
        return 1;
@@ -617,7 +618,7 @@ DEF_CMD(replace_to_search)
 
 DEF_CMD(replace_forward)
 {
-       struct pane *sp = ci->home->_data;
+       struct pane *sp = ci->home->data3;
 
        call(ci->key, sp);
 
@@ -631,14 +632,14 @@ DEF_CMD(replace_undo)
 
 DEF_CMD(replace_escape)
 {
-       struct pane *sp = ci->home->_data;
+       struct pane *sp = ci->home->data3;
 
        return call("search:done", sp);
 }
 
 DEF_CMD(replace_prev)
 {
-       struct pane *home = ci->home->_data;
+       struct pane *home = ci->home->data3;
        struct es_info *esi = home->data;
 
        if (esi->target)
@@ -648,7 +649,7 @@ DEF_CMD(replace_prev)
 
 DEF_CMD(replace_next)
 {
-       struct pane *home = ci->home->_data;
+       struct pane *home = ci->home->data3;
        struct es_info *esi = home->data;
 
        if (esi->target)