From 3357fc5a8fb400a1b33dda3a4cc1b42d1cfa7021 Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Sun, 20 Aug 2023 14:40:45 +1000 Subject: [PATCH] lib-renderline: allow word-wrap setting via attributes. 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 --- lib-renderline.c | 5 +++++ tests.d/D-test-markup | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib-renderline.c b/lib-renderline.c index 02543f05..7bad5e8a 100644 --- a/lib-renderline.c +++ b/lib-renderline.c @@ -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; diff --git a/tests.d/D-test-markup b/tests.d/D-test-markup index 417534ef..d199ca4e 100644 --- a/tests.d/D-test-markup +++ b/tests.d/D-test-markup @@ -1,2 +1,4 @@ This is my test file for markup -Now is the time for all good men to come to the aid of the party +Now is the time for all good men to come to the aid of the party + +Now is the time for all good men to come to the aid of the party -- 2.39.5