]> git.neil.brown.name Git - edlib.git/commitdiff
render-format: allow '<' characters in format fields.
authorNeilBrown <neil@brown.name>
Wed, 2 Dec 2015 03:40:23 +0000 (14:40 +1100)
committerNeilBrown <neil@brown.name>
Wed, 2 Dec 2015 03:40:23 +0000 (14:40 +1100)
These need to be quoted.

Signed-off-by: NeilBrown <neil@brown.name>
core-misc.c
misc.h
mode-emacs.c
render-format.c

index ff3d3a4170e7ffbae2d2f1f0b786e0ee84634448..3372dc77f0baff0d372b1cdad1f11397f9b99aa9 100644 (file)
@@ -50,3 +50,8 @@ void buf_append(struct buf *b, wchar_t wch)
                l = wcrtomb(t, wch, &ps);
        buf_concat_len(b, t, l);
 }
+
+void buf_append_byte(struct buf *b, char c)
+{
+       buf_concat_len(b, &c, 1);
+}
diff --git a/misc.h b/misc.h
index f031a94d80b118749c127e2c9c2b59996bbbed8b..3b0ce19899ad160f60f8e9ab9b38eead31c0e966 100644 (file)
--- a/misc.h
+++ b/misc.h
@@ -16,6 +16,7 @@ void buf_init(struct buf *b);
 void buf_concat(struct buf *b, char *s);
 void buf_concat_len(struct buf *b, char *s, int l);
 void buf_append(struct buf *b, wchar_t wch);
+void buf_append_byte(struct buf *b, char c);
 static inline char *buf_final(struct buf *b)
 {
        if (b->b)
index 38eb9cbb9efaad2bc548707f94c44297f115cdde..aa307df086a81df08336e9fca04fc12d48b3afe3 100644 (file)
@@ -437,7 +437,9 @@ DEF_CMD(emacs_doc_complete)
        struct pane *par, *pop;
        struct cmd_info ci2 = {0};
 
-       pop = pane_attach(ci->focus, "popup", ed->docs->home, "DM1");
+       pop = pane_attach(ci->focus, "popup", ed->docs->home, "DM1r");
+       if (!pop)
+               return -1;
        par = pane_final_child(pop);
 
        attr_set_str(&par->attrs, "line-format", "%+name", -1);
index fd59851384fd0621afa005018c76e3da3e6214dd..3df04bcc33a2d6809321d2b9955018a7889dd20c 100644 (file)
@@ -62,7 +62,7 @@ DEF_CMD(render_line)
                int w, adjust, l;
 
                if (*n != '%' || n[1] == '%') {
-                       buf_append(&ret, *n);
+                       buf_append_byte(&ret, *n);
                        if (*n == '%')
                                n += 1;
                        n += 1;
@@ -100,7 +100,12 @@ DEF_CMD(render_line)
                if (!val)
                        val = "-";
                if (*n != ':') {
-                       buf_concat(&ret, val);
+                       while (*val) {
+                               if (*val == '<')
+                                       buf_append_byte(&ret, '<');
+                               buf_append_byte(&ret, *val);
+                               val += 1;
+                       }
                        continue;
                }
                w = 0;
@@ -121,7 +126,9 @@ DEF_CMD(render_line)
                }
 
                while (*val && w > 0 ) {
-                       buf_append(&ret, *val);
+                       if (*val == '<')
+                               buf_append_byte(&ret, '<');
+                       buf_append_byte(&ret, *val);
                        w -= 1;
                        val += 1;
                }