wader / ansisvg

Convert ANSI to SVG
MIT License
89 stars 9 forks source link

Improved output for text selection and copy/paste #7

Closed wader closed 10 months ago

wader commented 10 months ago

Replace text elements with a text element per line which consists of tspan elements and remove all whitespace between tspan:s.

Replace figure space codepoint with normal whitespace and use xml:space="preserve" instead. Otherwise copied text would include a confusing non-U+0020 whitespace. This also fixes an issue with Inkscape not rendering underline for a text element with only whitespace.

With this combined copy/paste should work much better and even preserve new lines.

Note that tabs are not preserved at the moment, they get converted into spaces using 8 space tabulation.

Possibly also fixes issue in Safari with text baseline styling.

Inkescape issue has been reported here https://gitlab.com/inkscape/inbox/-/issues/9621

Fixes https://github.com/wader/ansisvg/issues/5

wader commented 10 months ago

@patrislav1 came up with possible better solution. uglier svg output but should look the same "everywhere" and probably better user experience as now you can select between styles and also all whitespace will be included when copying.

Please give it a try. Either checkout the better-select branch or use go run github.com/wader/ansisvg@better-select ...