ajaxorg / ace

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

Even after using monospace I am still getting cursor at wrong pos. #4685

Closed PtPrashantTripathi closed 1 year ago

PtPrashantTripathi commented 2 years ago

Hi team,

I am getting cursor at wrong place, in few of the privious issue which found in here there were mention to add this css

.ace_editor,
.ace_editor * {
    font-family: "Monaco", "Menlo", "Ubuntu Mono", "Droid Sans Mono", "Consolas",
        monospace !important;
    font-size: 13pt !important;
}

But even after using this css, we are still facing same issue

I have tried this with different browser and different os as well but same result

IMG_20220429_234347

This website is hosted here, try it you self to reproduce the bug

Note: instead of English we are type in devnagari, i hope this isn't it creating this issue

bhsmither commented 2 years ago

Observation: As I type a many-lettered word, and after it gets transliterated, the text insertion tool does, in fact, appear too far beyond the last glyph (is that the right word?) in the line of text.

But as I backspace, expecting to eventually delete the last glyph in the line, I see that a portion of the last glyph might disappear, then the rest of the glyph. As I continue to backspace, each of the glyphs, in turn, disappear portion-by-portion.

This suggests that this font has a lot of base glyphs with 'diacritic'-style accessory glyphs.

ACE seems to be positioning the text insertion cursor as if each of the base and accessory glyphs have some width to them - even though the accessory (diacritical) glyphs probably should not have a width.

PtPrashantTripathi commented 2 years ago

@bhsmither any suggestions what should I do.

gabereiser commented 2 years ago

This is an issue when the editor is embedded on a page when it's not position: absolute;

PtPrashantTripathi commented 2 years ago

This is an issue when the editor is embedded on a page when it's not position: absolute;

@gabereiser i am using position: absolute; still facing this issue https://github.com/vedic-lang/vedic-ide/blob/1d3f84cdc483cd1aa8638cff181c7e435fdfbc42/css/styles.css#L45

gabereiser commented 2 years ago

I was too. I found calling editor.resize(); after displaying helped fix the issue for me. See if that help you as well.

editor.session.setValue(contents);
$editor.style.visibility = 'visible';
editor.resize();

editor is the var for ace.edit(). $editor is the DOMElement of my ace editor.

github-actions[bot] commented 1 year ago

This issue has not received any attention in 1 year. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.

PtPrashantTripathi commented 1 year ago

Let's close the issue since your team no solutions.