]> git.neil.brown.name Git - edlib.git/commitdiff
Disable recursive popups except by permission.
authorNeilBrown <neil@brown.name>
Wed, 2 Dec 2015 02:11:24 +0000 (13:11 +1100)
committerNeilBrown <neil@brown.name>
Wed, 2 Dec 2015 02:11:24 +0000 (13:11 +1100)
So trying to search in a file-file buffer now doesn't work.

This might need work for searching in a completion list??

Signed-off-by: NeilBrown <neil@brown.name>
lib-popup.c
mode-emacs.c

index 8b04d8fd4588832462e80af056864413a1b8aea8..aa8d97246f669b77f95a2d8f884d15d113246190 100644 (file)
@@ -125,6 +125,7 @@ DEF_CMD(popup_attach)
         * TBLR - 0, 1, or 2 can be given for center, side, or corner
         * M  - multi line, else one line
         * 1234 - how many quarters of width to use.(default 2);
+        * r  - allow recursive popup
         */
        struct pane *root, *p;
        struct popup_info *ppi = malloc(sizeof(*ppi));
@@ -137,6 +138,11 @@ DEF_CMD(popup_attach)
        if (!style)
                style = "D3";
 
+       if (!strchr(style, 'r') &&
+           pane_attr_get(ci->focus, "Popup") != NULL)
+               /* No recusive popups without permission */
+               return 0;
+
        if (strchr(style, 'D')) {
                int x = 0, y = 0;
                pane_to_root(ci->focus, &x, &y, &z, NULL, NULL);
@@ -156,6 +162,7 @@ DEF_CMD(popup_attach)
                        border[j++] = "TLBR"[i];
        }
        border[j] = 0;
+       attr_set_str(&ppi->popup->attrs, "Popup", "true", -1);
        attr_set_str(&ppi->popup->attrs, "borders", border, -1);
        attr_set_str(&ppi->popup->attrs, "render-wrap", "no", -1);
 
index bdf5d54379113ae5e8372ebb25dfab785f4bc36c..99d27c4024614515d1d648d0ef7386123d4d4cd3 100644 (file)
@@ -347,7 +347,9 @@ DEF_CMD(emacs_file_complete)
        }
        docp = doc_open(ed, fd, d);
        close(fd);
-       pop = pane_attach(ci->focus, "popup", docp, "DM1");
+       pop = pane_attach(ci->focus, "popup", docp, "DM1r");
+       if (!pop)
+               return -1;
        par = pane_final_child(pop);
 
        attr_set_str(&par->attrs, "line-format", "%+name%suffix", -1);