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

Invisible UTF-8 Joiner Characters getting copied #38

Open
hostilefork opened this issue Mar 28, 2019 · 2 comments
Open

Invisible UTF-8 Joiner Characters getting copied #38

hostilefork opened this issue Mar 28, 2019 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@hostilefork
Copy link
Owner

There are some nasty zero width joiners used to make the cursor properly appear in divs that would otherwise be empty.

Attempts to do this with plain CSS failed. But the problem with using the joiners is that Copying and Pasting keeps them.

Ideally there can be a way to get the desired behavior without the joiners. But if not, they need to be filtered when copying data out of the Replpad...as they cause invisible screwy things to appear when pasting anywhere (here on GitHub, into source editors, etc.)

@hostilefork hostilefork assigned hostilefork and BrianOtto and unassigned BrianOtto Apr 1, 2019
@hostilefork
Copy link
Owner Author

Hm, I remember very clearly something not working when I didn't have the joiner there. But now I delete it and don't notice a difference. :-/

Some things have changed so maybe it's fixed?

I'll keep an eye on it...

@BrianOtto
Copy link
Collaborator

BrianOtto commented Apr 1, 2019

When I re-wrote the UI Builder code, I was having an issue with the cursor not appearing in the input div when it was empty. I did some research into this and found out it was happening because that div has display set to inline (so that it would display on the same line as the prompt). When an inline element has no content it takes up no space, and this causes the cursor to get hidden by the browser because there is no room to display it. If a character is entered then the cursor will appear.

I thought the zero width joiner was a trick to fix this issue, by having an "invisible" character in the div (and widening it enough for a cursor to appear). However, I tested this, and it didn't do anything. So I just removed it completely.

What does work is adding padding-left to the div. Some posts on Stack Overflow were saying you only need to add 1px and that is enough to get the cursor to appear, but I found I needed at least 3px. But there is a caveat when doing things this way... if you look closely enough the cursor jumps a bit when you click on the far left side of the input div. This is because you've click into the input div, but it has left padding now and so the cursor jumps to where the padding starts.

Anyway, long story short, I don't think the joiner is needed. However, I don't understand how the cursor is displaying for you, when the REPL starts off with an empty div. I couldn't get it working in my original implementation, but I guess there must have been something in your layout that I overlooked.

I ended up scrapping the contenteditable div completely and going with a standard <input>. I just hid the borders and all is good now, but this really only works for me because my app doesn't support multi-line content... though maybe you could get a <textarea> working in a similar fashion, if you do run into issues again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants