]> git.neil.brown.name Git - edlib.git/commitdiff
lib-renderline: allow word-wrap setting via attributes.
authorNeilBrown <neil@brown.name>
Sun, 20 Aug 2023 04:40:45 +0000 (14:40 +1000)
committerNeilBrown <neil@brown.name>
Sun, 20 Aug 2023 22:47:14 +0000 (08:47 +1000)
Word-wrap is normally enabled for the whole pane.  But making it
possible for individual lines might be useful, and certainly eases
testing.

Signed-off-by: NeilBrown <neil@brown.name>
lib-renderline.c
tests.d/D-test-markup

index 02543f05669e26977b8a3cf1a467755066d66082..7bad5e8abd181a62091eb4f2f6aab6c08ac282a5 100644 (file)
@@ -286,6 +286,11 @@ static void parse_line(struct rline_data *rd safe)
                                        aupdate(&rd->wrap_tail, v);
                                } else if (aprefix(a, "wrap-")) {
                                        aappend(&wrapattr, a+5);
+                               } else if (amatch(a, "word-wrap")) {
+                                       if (!v || *v == '1')
+                                               rd->word_wrap = 1;
+                                       else if (*v == '0')
+                                               rd->word_wrap = 0;
                                } else if (amatch(a, "hide")) {
                                        hide = ++hide_num;
                                        hide_depth = old_len;
index 417534ef66a881957d3d7cecd0c10171035bc950..d199ca4e66d952cf661d2e4303064d017eada7fe 100644 (file)
@@ -1,2 +1,4 @@
 <space-above:40,space-below:10,20,fg:blue,bg:yellow,center>This is my test file for markup</>
-<wrap-tail:,wrap-head:-),wrap-,right:400,left:70>Now is the time for all good men to come to the aid of the party</a>
+<word-wrap,wrap-tail:,wrap-head:-),wrap-,right:300,left:70>Now is the time for all good men to come to the aid of the party</a>
+
+<wrap-tail:,wrap-head:-),wrap-,right:300,left:70>Now is the time for all good men to come to the aid of the party</a>