tmake (soft)line-wrapping an option, still WIP though - webdump - [FORK] git://git.codemadness.org/webdump
 (HTM) git clone git://git.z3bra.org/webdump.git
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 4114c598f45d4e1176a018f6532545b622f8d0e0
 (DIR) parent 46afcf5acd4771e10f93530cd4108a14dc416564
 (HTM) Author: Hiltjo Posthuma <hiltjo@codemadness.org>
       Date:   Thu, 21 Nov 2019 00:24:07 +0100
       
       make (soft)line-wrapping an option, still WIP though
       
       Diffstat:
         M webdump.c                           |      16 ++++++++--------
       
       1 file changed, 8 insertions(+), 8 deletions(-)
       ---
 (DIR) diff --git a/webdump.c b/webdump.c
       t@@ -29,8 +29,9 @@ struct uri {
        };
        
        /* options */
       -static int allowesc     = 0;  /* alloc ANSI escape codes */
       +static int allowesc     = 1;  /* alloc ANSI escape codes */
        static int showlinkrefs = 0;  /* show link references at the bottom */
       +static int softlinewrap = 0;  /* soft line-wrapping */
        static int termwidth    = 72; /* terminal width */
        
        #define LINKREFS
       t@@ -248,7 +249,7 @@ newline(void)
                ncharsline = 0;
        }
        
       -/* print one character safely */
       +/* print one character safely: no control characters */
        static void
        printc(int c)
        {
       t@@ -267,12 +268,11 @@ printc(int c)
                        }
                }
        
       -#if 1
       -        /* DEBUG: soft line-wrapping on white-space and certain characters like ',' */
       -        /* TODO: better line-wrapping */
       -        if (strchr(" \n\t", c) && ncharsline >= termwidth)
       -                newline();
       -#endif
       +        if (softlinewrap) {
       +                /* TODO: harder line-wrapping on "non-word" characters */
       +                if (strchr(" \n\t", c) && ncharsline >= termwidth)
       +                        newline();
       +        }
        }
        
        /* Find nearest parent node belonging to type. For example a listitem -> list */