cyanskies / another-toml-cpp

MIT License
1 stars 0 forks source link

Add a new writer option for indent wrapping #12

Closed cyanskies closed 3 months ago

cyanskies commented 3 months ago

Add a new option to the writer settings: indent_after_wrapping. This setting will ad an extra indentation after wrapping long lines. This indentation is designed to make it easier to pick out the start of the next key-value pair. This can be toggled independently of the regular indentation setting as it should be applicable even when that setting is disabled. The writer will add a number of spaces to bring the next line up to the same column as the start of the value (the '[' in the array examples below).

Following examples show the expected output with this setting enabled or disabled:

[disabled]
x = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42,
43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55]
y = "next key-value pair"
[enabled]
x = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
    22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41,
    42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55]
y = "next key-value pair"