Escaped numbers in brackets cause incorrect WordWrap
Here's an example line:
Donec vitae elit urna. Nulla facilisi[1][2] Morbi massa nibh, faucibus tristique vulputate vel, blandit a dolor. Praesent nec vehicula arcu. Vestibulum vel egestas mauris. Vivamus tincidunt tempus ipsum ore mollis. Pellentesque et mollis tellus. Nunc sed posuere enim. Morbi non sem porttitor, ultricies lectus sit amet, hendrerit risus. Nam ultricies dui et dolor pretium, gravida sollicitudin enim luctus. Duis aliquam nibh arcu, congue efficitur metus euismod in. Ut nec purus eleifend, pharetra sapien a, ullamcorper metus. Maecenas vehicula venenatis velit, non aliquet libero volutpat a. Morbi ac luctus elit, in consectetur neque. Aliquam consequat placerat odio vel condimentum. Praesent semper placerat cursus.
If you use cview.WordWrap
, a newline is inserted at the first space before the numbers, so facilisi[1][2]
starts the new line, even though it hasn't hit the max number of columns. Empty brackets ([][]
) do not cause the issue.
The bracketed numbers alone still cause the issue: ...urna. Nulla facilisi [1][2] Morbi massa nibh, fauc...
Removing the space to the right fixes the issue: ...urna. Nulla facilisi [1][2]Morbi massa nibh, fauc...
The issue still occurs with spacing and words between the numbers: Nulla facilisi[2] example[1] Morbi massa nibh, faucibus
, with the newline starting right before example[1]
.
Please note that cview.Escape
was used before wrapping, and all the examples above show the brackets how they are displayed and were typed, not how they are represented internally by cview.