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

Double quotation auto insert bug on Macos #4298

Closed
1 task done
allyfx opened this issue Dec 25, 2023 · 14 comments · Fixed by #7611
Closed
1 task done

Double quotation auto insert bug on Macos #4298

allyfx opened this issue Dec 25, 2023 · 14 comments · Fixed by #7611
Labels
bug [core label] internationalization Feedback for human language support, translations, etc

Comments

@allyfx
Copy link

allyfx commented Dec 25, 2023

Check for existing issues

  • Completed

Describe the bug / provide steps to reproduce it

On Mac you need to add double quotes and then hit space for it to be considered as a single character. For example, if I type " and then the character a without hitting space it makes this character -> ä. But when I hit space on Zed it doubles the quotes like this """" and I have to remove the quote.

This is because of the keyboard layout. In Brazilian's we need to have this feature because of the language's accents that has conflict with english's quotes. For example the ' can also be used to create the é accent.

So maybe this is a bug that happens because of different keyboard layouts.

Environment

MacBook Pro M1 macOS Sonoma 14.1.2
Brazilian input sources (Brazilian input layout)
Screenshot 2023-12-25 at 12 17 59

If applicable, add mockups / screenshots to help explain present your vision of the feature

2023-12-25.12-27-34.mp4

If applicable, attach your ~/Library/Logs/Zed/Zed.log file to this issue.

If you only need the most recent lines, you can run the zed: open log command palette action to see the last 1000.

No response

@allyfx allyfx added admin read Pending admin review bug [core label] triage Maintainer needs to classify the issue labels Dec 25, 2023
@JosephTLyons JosephTLyons added internationalization Feedback for human language support, translations, etc and removed triage Maintainer needs to classify the issue admin read Pending admin review labels Jan 2, 2024
@JosephTLyons JosephTLyons transferred this issue from zed-industries/community Jan 24, 2024
@andremacola
Copy link

andremacola commented Jan 27, 2024

I had already posted in some issues about the problem, but they never took this issue seriously with International English-type keyboards. I hope that now that it has become open source, we can see some progress in this area.

Zed is almost unusable for those who use keyboards that are not US and need accentuation.

There are several problems that exist, but I also highlight one which is:

1 - Select a sentence or a string.
2 - Put double quotes so that quotes are applied to the entire selection.
3 - Press any key on the keyboard and the quotes will multiply.

Gravacao.de.Tela.2024-01-27.as.14.14.13.mov

@allyfx
Copy link
Author

allyfx commented Jan 28, 2024

@andremacola Yes! This happens to me as well. This and other issues make Zed unusable for me while working and on a daily environment. Now I can only use it when I'm working on personal projects (which I'm ashamed to say is not a big part of my weeks). Now that it's open source I believe we can get together to find a solution for this.

I'll try and see if I find anything, if you want to join me let me know. It'd be really helpful (I have zero to none experience with editors haha)

@t1gu1
Copy link

t1gu1 commented Feb 2, 2024

This is the issue that makes Zed really frustrating and not really usable for me.

My keyboard layout is US international.

I even change that setting to be false "use_autoclose": false and still have that issue..

I would use the editor live if it wasn't that bug.
It feels kind of a critical issue to me.

Even Theo got that issue: https://youtu.be/ZOYp6-k9HhE?si=vj6-WN_xqSu-gu_S&t=806

Here another example: https://s3.amazonaws.com/tempmedia.tumblr.com/fe7517f3da1633e9d93f98af29774816/378h96qfpnsw4ooso0c48ogww_tumblr_tmp.mp4

@mrnugget
Copy link
Member

mrnugget commented Feb 5, 2024

Can someone give me some exact steps to reproduce and expected vs. actual behaviour?

I just switched to the Brazilian layout and I can type " and ä and "" fine:

screenshot-2024-02-05-11.37.35.mp4

Is the problem that you don't have to press <space> to get out of the dead key state?

@allyfx
Copy link
Author

allyfx commented Feb 5, 2024

@mrnugget Basically the problem is that we don't have support for when you want to press <space> to get out of the dead key state, because doing so will duplicate the quotes.

As I said, in Brazillian's keyboard we need this feature to leave the state of (I'll call it "pressed quote"). If you don't press <space> and instead press any vowel it'll add accents.

If you're using Mac, you'll see that when you type one of the quotes before pressing <space> the quote gets highlighted with an underscore, indicating that it's in the "pressed quote" state and that if you press a vowel it'll apply the accent. See attached image:
Capture d’écran 2024-02-05 à 08 34 19

The current behavior is:

  • Press " and it creates ""
  • Press <space> and it duplicates """"

The expected behavior is:

  • Press " and it creates "" (or not, this should be customizable)
  • Press <space> and it leaves the "pressed quote" state and doesn't duplicate the quotes

With the expected behavior it'll prevent annoying problems like:

  • Press ' and it creates ''
  • Press a and it changes to á

Hope this explanation explains better. Let me know if you need further informations.

@mrnugget
Copy link
Member

mrnugget commented Feb 5, 2024

Thanks @allyfx! Very helpful. One question: when you open an empty new buffer, with no language set, do you agree that it works as expected? i.e. the input handling is only a problem when auto-insertion of brackets is involved, yes?

@tomas-goncalves
Copy link

I'm going to chime in here. In a new buffer, while the double quoting issue is fixed, if you type a quote you have to press backspace twice to delete it. I believe this is because Macos has two states for quotes in portuguese. One is when you first press it and the other is after you press another key and it rules out accentuation.

@andremacola
Copy link

Can someone give me some exact steps to reproduce and expected vs. actual behaviour?

I just switched to the Brazilian layout and I can type " and ä and "" fine:

screenshot-2024-02-05-11.37.35.mp4
Is the problem that you don't have to press <space> to get out of the dead key state?

Not only Brazilian keyboard but US International mapping.

@ponei
Copy link

ponei commented Feb 6, 2024

Also experiencing this. Very annoying when typing anything related to strings.

@mrnugget
Copy link
Member

mrnugget commented Feb 7, 2024

Doesn't fix this yet, but it's certainly one first improvement: #7488

@mrnugget
Copy link
Member

mrnugget commented Feb 9, 2024

Doesn't fix this yet either, but here's the next improvement: #7494

@mrnugget
Copy link
Member

mrnugget commented Feb 9, 2024

Here's the final fix: #7611

mrnugget added a commit that referenced this issue Feb 9, 2024
This fixes two annoyances when composing text and autoclose is enabled.

Example: use a Brazilian keyboard and type `"`, which triggers a
dead-key state.

Previously when a user would type `"<space>` to get a quote, we'd end up
with 4 quotes.

When text was selected and a user then typed `"<space>` the selected
text would be deleted.

This commit fixes both of these issues.

Fixes #4298

Release Notes:

- Fixed autoclose behavior not working when composing text via IME (e.g.
using quotes on a Brazilian keyboard)
([#4298](#4298)).

Co-authored-by: Antonio <antonio@zed.dev>
Co-authored-by: bennetbo <bennetbo@gmx.de>
@joyousblunder
Copy link

Hey, I am having the exactly same problem here. Brazilian with an International English keyboard, but this time on Fedora linux 41 and zed 0.164.2. Can we reopen the issue or create a new one?

@Nic-Soares
Copy link

Nic-Soares commented Dec 30, 2024

Same error here

¨ + space resulting in """""""

Screencast.From.2024-12-30.12-13-28.mp4

Fedora 41 - Zed 0.166.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug [core label] internationalization Feedback for human language support, translations, etc
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants