From f1e2f81e797be029bbc0f0d48302722bf2069013 Mon Sep 17 00:00:00 2001 From: Patrick Pelissier Date: Wed, 21 Oct 2020 23:49:47 +0200 Subject: [PATCH] Improve formating of macros: if the line is too long and can be reduced, reduce it. --- example/ex-string01.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/example/ex-string01.c b/example/ex-string01.c index 60cac101..249df843 100644 --- a/example/ex-string01.c +++ b/example/ex-string01.c @@ -20,6 +20,16 @@ static void format(FILE *f) } string_push_back(s, '\\'); } + if (n >= MAX_COLUMN && string_get_char(s, n-1) == '\\') { + n--; + string_left(s, n); + while (n >= MAX_COLUMN-2 && string_get_char(s, n-1) == ' ') { + n--; + string_left(s, n); + } + string_push_back(s, ' '); + string_push_back(s, '\\'); + } printf("%s\n", string_get_cstr(s)); } string_clear(s);