Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved output for text selection and copy/paste #7

Merged
merged 1 commit into from
Dec 5, 2023
Merged

Conversation

wader
Copy link
Owner

@wader wader commented Dec 2, 2023

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 #5

@wader
Copy link
Owner Author

wader commented Dec 2, 2023

@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 ...

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 #5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consolidate text to allow copy/paste
1 participant