argtable / argtable3

A single-file, ANSI C, command-line parsing library that parses GNU-style command-line options.
http://www.argtable.org
Other
372 stars 65 forks source link

added two features to arg_print_formatted_ds #77

Closed ph2355 closed 1 year ago

ph2355 commented 1 year ago

resolves https://github.com/argtable/argtable3/issues/76

  1. If newline found in text, it is printed and column count is reset.

    Previously line wrap would not take newlines found in text into account. Resulting in line wrap feature working incorrectly.

    Example: text: "a b\n c d" line width: 6

    previously: "a b" "c" <- c in new line because of \n in text "d" <- d in new line because column count reached 6 at "c" and line wrap inserted newline

    now: "a b" "c d" <- "c d" in new line because of \n in text, line wrap does not insert newline between c and d

  2. If a very long word is in text, it is broken up differently than before. Previously the long word was printed one character per line. Now as much characters of the long word as can fit in a line are printed.

    Example: text: "test" line width: 3

    previously: t e s t

    now: tes t

tomghuang commented 1 year ago

@ph2355 ,

Thank you very much for your pull request. I'll check it and see if I can add some unit test cases for this new behavior.