ajaxorg / ace

Ace (Ajax.org Cloud9 Editor)
https://ace.c9.io
Other
26.69k stars 5.28k forks source link

fix: ghost text rendering of empty lines #5615

Closed akoreman closed 2 months ago

akoreman commented 2 months ago

Issue #, if available: NA

Description of changes: In the ghost text, we set the content of a line as the text content of a div. For lines without any text (e.g. when the suggestion has a line of white space) this results in a div without any contents, which most browsers will not render. This change sets a space as the text content if it's empty to ensure the empty lines get rendered.

Before this change:

https://github.com/user-attachments/assets/7c03e522-b978-4ed9-9f28-ea4b7eb9cf1e

After:

https://github.com/user-attachments/assets/f3f3b371-3e83-4c28-938b-cbd18310e5f2

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Pull Request Checklist:

codecov[bot] commented 2 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 86.89%. Comparing base (ed233cf) to head (b60cd72).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #5615 +/- ## ======================================= Coverage 86.89% 86.89% ======================================= Files 594 594 Lines 43143 43151 +8 Branches 7150 7151 +1 ======================================= + Hits 37489 37497 +8 Misses 5654 5654 ``` | [Flag](https://app.codecov.io/gh/ajaxorg/ace/pull/5615/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ajaxorg) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/ajaxorg/ace/pull/5615/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ajaxorg) | `86.89% <100.00%> (+<0.01%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ajaxorg#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.