Skip to content
This repository has been archived by the owner on Jun 16, 2020. It is now read-only.

This emoji causes subsequent text to be hidden in SVG output #89

Closed
fawkesley opened this issue Jan 8, 2019 · 7 comments
Closed

This emoji causes subsequent text to be hidden in SVG output #89

fawkesley opened this issue Jan 8, 2019 · 7 comments

Comments

@fawkesley
Copy link

fawkesley commented Jan 8, 2019

termtosvg
echo "before πŸ•΅οΈβ€ after"

Gives this SVG output, where the word "after" is not visible:

https://gist.github.com/paulfurley/4e74ecc062837edcf9a3270849915182

Here's a static screenshot

image

I'm using termtosvg==0.7.0 on Ubuntu 18.04

BTW thanks for making termtosvg, we loveit! It's extremely useful for illustrating release notes for Fluidkeys, our command-line app

@fawkesley fawkesley changed the title This emoji causes subsequent text to be hidden in csv output This emoji causes subsequent text to be hidden in SVG output Jan 8, 2019
@fawkesley
Copy link
Author

Can others reproduce this?

@jedahan
Copy link

jedahan commented Jan 18, 2019

Could not reproduce with termtosvg 0.7.0 on macOS 10.14.2 with alacritty 0.2.0, zsh 5.6.2

@nbedos
Copy link
Owner

nbedos commented Jan 18, 2019

Can others reproduce this?

Yes I can reproduce this behavior, I just haven't had time to investigate further. I'll try to look at this in the next few days.

@Rondom
Copy link
Contributor

Rondom commented Jan 18, 2019

Yes, I can. Using the following script I isolated the issue to two unicode-codepoints in your string that make the issue appear. See also: https://www.fontspace.com/unicode/analyzer/?q=before+%F0%9F%95%B5%EF%B8%8F%E2%80%8D+after

#!/bin/sh -eu
u_sleuth="\xf0\x9f\x95\xb5"
u_emoj_vs16="\xef\xb8\x8f"
u_zero_width_joiner="\xe2\x80\x8d"

echo -e "         original test: ABCDEFG${u_sleuth}${u_emoj_vs16}${u_zero_width_joiner}ABCDEFG"
echo -e "           just sleuth: ABCDEFG${u_sleuth}ABCDEFG"
echo -e "       just emoj vs-16: ABCDEFG${u_emoj_vs16}ABCDEFG"
echo -e "just zero-width-joiner: ABCDEFG${u_zero_width_joiner}ABCDEFG"

All lines but the second line (just the sleuth) show the issue for me. Maybe this is a pyte-issue? Do they have some example-app to check?

@nbedos
Copy link
Owner

nbedos commented Jan 19, 2019

@Rondom Thanks for investigating. I did some tests and it turns out Pyte drops all data following an "unprintable" character (the zero width joiner of your test case) : https://github.com/selectel/pyte/blob/0.8.0/pyte/screens.py#L522

A simple workaround is to feed Pyte a single character at a time so that if a character is not printable it does not affect the rest of the line. I've implemented this via 1a45282. Let met know if that fixes the issue.

nbedos added a commit that referenced this issue Jan 20, 2019
Feed data to Pyte one character at a time so that
Pyte ignoring data after a zero-width character
isn't a problem.

While we're at it, replace pyte.ByteStream by
pyte.Stream to simplify the code
@nbedos
Copy link
Owner

nbedos commented Jan 20, 2019

Fix released as part of 0.8.0. Let me know if it doesn't solve the issue.

@nbedos nbedos closed this as completed Jan 20, 2019
@fawkesley
Copy link
Author

Amazing, yes I can confirm that's fixed it for me. Thank you!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants