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

auto completion keyword popup removing white spaces from text when split into span elements #5530

Closed
ProbitDafydd opened this issue Apr 5, 2024 · 3 comments

Comments

@ProbitDafydd
Copy link

ProbitDafydd commented Apr 5, 2024

Describe the bug

Under certain conditions, auto completion keyword lines containing white spaces collapse the white space character when the cursor reaches the white space. Or put another way, when the keyword is split into multiple span elements.

This is due to the white-space: nowrap; rule that presumably was to prevent new line characters from messing up the layout, so a fix would require accommodating both white spaces and new lines.

white-space: nowrap;

white_space_ace_popup_before
white_space_ace_popup_after
white_space_ace_popup_html

Expected Behavior

That white spaces do not collapse when split up into span elements

Current Behavior

pre-seeding white spaces collapse when the keyword is split into span elements

Reproduction Steps

Enable auto completion options for keyword suggestions.
Have keywords that contain white spaces.
Type a word containing a white space, ensuring all character before the white space is typed, or in other words when the cursor reaches the white space.

Possible Solution

Replace all white spaces with   in the keyword text that end up in a span, so that nowrap can't collapse them.

Additional Information/Context

The solution needs to consider both white space and new lines.

Removing the nowrap rule would fix this as it goes back to pre from .ace_layer, however it would break the layout when new lines are present.

nowrap - removes pre-seeding white spaces and ignores new lines
pre - allows pre-seeding white spaces, but does not ignore new lines

Keeping nowrap and replacing white spaces with   seems the best option to me.

Ace Version / Browser / OS / Keyboard layout

current, n/a

@marinsokol5
Copy link
Contributor

Hey,
that looks indeed quite unfortunate, affecting basically all custom modes with spaces in the keyword or custom completers with spaces in captions.

Thanks for reporting, we will look into it.

@marinsokol5
Copy link
Contributor

For anyone else trying to trigger it, it's immediately visible at https://mkslanc.github.io/ace-playground/#custom-completions

@akoreman
Copy link
Contributor

This issue should be fixed by #5539 and should be part of the next release after 1.33.1.

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

No branches or pull requests

3 participants