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

Support soft-wrapping of ghost text #5513

Closed
2 tasks
kevinushey opened this issue Mar 19, 2024 · 2 comments
Closed
2 tasks

Support soft-wrapping of ghost text #5513

kevinushey opened this issue Mar 19, 2024 · 2 comments

Comments

@kevinushey
Copy link
Contributor

Describe the feature

Currently, when displaying ghost text within an Ace instance, that text is not soft-wrapped. For example observe how the first line (real text) is wrapped, while the second line is not:

Screenshot 2024-03-18 at 6 40 09 PM

Use Case

Soft-wrapping of ghost text when enabled would better match the user intention.

Proposed Solution

It looks like ghost text is added as a single token "ghost_text" here:

ace/src/virtual_renderer.js

Lines 1761 to 1762 in 099011b

var textLines = text.split("\n");
this.addToken(textLines[0], "ghost_text", insertPosition.row, insertPosition.column);

I wonder if the ghost text could be split into separate tokens, and added individually? A simple implementation would be to just split on whitespace, and I think that would be enough to make sure the rendered text obeys soft-wrapping rules.

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

ACE version used

version 1.32.7

@kevinushey kevinushey changed the title Suport soft-wrapping of ghost text Support soft-wrapping of ghost text Mar 19, 2024
@akoreman
Copy link
Contributor

We added soft-wrapping of ghost text as part of #5540, it will be included in the next Ace release after 1.33.1.

@kevinushey
Copy link
Contributor Author

That's fantastic -- thank you!

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