]> git.neil.brown.name Git - edlib.git/commitdiff
doc-email: switch to embedded data.
authorNeilBrown <neil@brown.name>
Wed, 19 Jul 2023 08:41:22 +0000 (18:41 +1000)
committerNeilBrown <neil@brown.name>
Wed, 19 Jul 2023 10:37:43 +0000 (20:37 +1000)
struct email_view is now embedded in the pane, no found by a pointer deref.

Signed-off-by: NeilBrown <neil@brown.name>
DOC/TODO.md
doc-email.c

index 56a2358c20bd700202df1a3831e37ca6bfe30b53..4687dac84cffab312a15581e06bea611260495e6 100644 (file)
@@ -4,10 +4,33 @@ To-do list for edlib
 Current priorities
 ------------------
 
-All of these, except Trivial, are references to todo items elsewhere in
+All of these, except Triage, are references to todo items elsewhere in
 the file.
 
-### Trivial
+### Triage
+
+- [ ] If a pane with shift-disabled has cursor past the right edge, the
+      cursor gets positioned outside the window
+- [ ] when find-file dialog shifts left, it doesn't shift back until
+      cursor is v.close to left, even when the rest of the line is blank
+- [ ] line-count in make output is weird.  Second line can be thousands
+- [ ] Make sometimes doesn't follow output, though usually it does
+- [ ] If dynamic-complete only finds one completion, does it still want
+      a menu?
+- [ ] When merge makes a change, highlight the new content.
+- [ ] Review the options for editing a merge - it doesn't always do what
+      I want.  Maybe have a menu of choices to remind me
+- [ ] cursor is sometimes off-screen when it shouldn't be.  I don't know
+      what cause this yet, but I will try to remember to take notes next
+      time.
+      When seaching backwards and result is just above display, the
+      result doesn't get shown.  Sometimes.
+- [ ] visiting a new file from a 44 popup is weird.
+- [ ] search in history always finds a new history line.  It doesn't
+      check if new patterns still matches this line.
+- [ ] in notmuch cursor should go to search result when changing
+      messages.
+- [ ] menu for address completions in email-compose
 
 - [X] give every pane a link to root/editor main and use that
       instead of statics.  Then maybe times_up() can use pane_too_long()
index 0bbb9483c4e8b1e7459abf4ee681b08a9fd71c26..fa782da1de26fda87b53c42d82c1468a9413dc5e 100644 (file)
 #include <wctype.h>
 #include <ctype.h>
 #include <stdio.h>
+
+#define PANE_DATA_TYPE struct email_view
+
 #include "core.h"
 #include "misc.h"
 
+struct email_view {
+       int     parts;
+       char    *invis safe;
+};
+
+#include "core-pane.h"
+
 static inline bool is_orig(int p)
 {
        return p >= 0 && p % 3 == 0;
@@ -947,17 +957,11 @@ out:
        return Efail;
 }
 
-struct email_view {
-       int     parts;
-       char    *invis safe;
-};
-
 DEF_CMD(email_view_free)
 {
-       struct email_view *evi = ci->home->data;
+       struct email_view *evi = &ci->home->data;
 
        free(evi->invis);
-       unalloc(evi, pane);
        return 1;
 }
 
@@ -980,7 +984,7 @@ static int email_step(struct pane *home safe, struct mark *mark safe,
                      int forward, int move)
 {
        struct pane *p = home;
-       struct email_view *evi = p->data;
+       struct email_view *evi = &p->data;
        wint_t ret;
        int n = -1;
 
@@ -1058,7 +1062,7 @@ DEF_CMD(email_content)
         * what is invisible, marking all spacers as invisible
         */
        struct pane *p = ci->home;
-       struct email_view *evi = p->data;
+       struct email_view *evi = &p->data;
        char *invis2 = strsave(p, evi->invis);
        int i;
 
@@ -1074,7 +1078,7 @@ DEF_CMD(email_content)
 DEF_CMD(email_set_ref)
 {
        struct pane *p = ci->home;
-       struct email_view *evi = p->data;
+       struct email_view *evi = &p->data;
 
        if (!ci->mark)
                return Enoarg;
@@ -1086,7 +1090,7 @@ DEF_CMD(email_set_ref)
 DEF_CMD(email_step_part)
 {
        struct pane *p = ci->home;
-       struct email_view *evi = p->data;
+       struct email_view *evi = &p->data;
 
        if (!ci->mark)
                return Enoarg;
@@ -1098,7 +1102,7 @@ DEF_CMD(email_view_get_attr)
 {
        int p;
        char *v;
-       struct email_view *evi = ci->home->data;
+       struct email_view *evi = &ci->home->data;
 
        if (!ci->str || !ci->mark)
                return Enoarg;
@@ -1124,7 +1128,7 @@ DEF_CMD(email_view_get_attr)
 DEF_CMD(email_view_set_attr)
 {
        int p;
-       struct email_view *evi = ci->home->data;
+       struct email_view *evi = &ci->home->data;
 
        if (!ci->str || !ci->mark)
                return Enoarg;
@@ -1206,7 +1210,10 @@ DEF_CMD(attach_email_view)
        if (n <= 0 || n > 1000 )
                return Einval;
 
-       alloc(evi, pane);
+       p = pane_register(ci->focus, 0, &email_view_handle.c);
+       if (!p)
+               return Efail;
+       evi = &p->data;
        evi->parts = n;
        evi->invis = calloc(n+1, sizeof(char));
        for (i = 0; i < n; i++) {
@@ -1220,11 +1227,6 @@ DEF_CMD(attach_email_view)
                        /* Everything else default to invisible */
                        evi->invis[i] = 'i';
        }
-       p = pane_register(ci->focus, 0, &email_view_handle.c, evi);
-       if (!p) {
-               free(evi);
-               return Efail;
-       }
        p2 = call_ret(pane, "attach-line-count", p);
        if (p2)
                p = p2;