Wrong cursor position with ace editor.

2,157 views
Skip to first unread message

Christian Andersen

unread,
Aug 3, 2016, 4:38:42 PM8/3/16
to Ajax.org Cloud9 Editor (Ace)
When typing with the editor it looks like the cursor is a few steps back from the text being typed. Looking online I was wondering if this could be an issue with fonts. I looked and I am using whatever the default fonts are for the ace editor. The only thing that I am changing would be the font size; I assume that by default ace editor is using a monospace font. I am noticing this for various themes.

Harutyun Amirjanyan

unread,
Aug 3, 2016, 4:59:33 PM8/3/16
to ace-d...@googlegroups.com
Ace editor can work only with monospace font, could you give a screenshot showing the issue?
How do you set the font size, it can break rendering too when different font sizes are used for different elements in the editor.

On Thu, Aug 4, 2016 at 12:37 AM, Christian Andersen <c.ander...@gmail.com> wrote:
When typing with the editor it looks like the cursor is a few steps back from the text being typed. Looking online I was wondering if this could be an issue with fonts. I looked and I am using whatever the default fonts are for the ace editor. The only thing that I am changing would be the font size; I assume that by default ace editor is using a monospace font. I am noticing this for various themes.

--
You received this message because you are subscribed to the Google Groups "Ajax.org Cloud9 Editor (Ace)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ace-discuss...@googlegroups.com.
To post to this group, send email to ace-d...@googlegroups.com.
Visit this group at https://groups.google.com/group/ace-discuss.
For more options, visit https://groups.google.com/d/optout.

Christian Andersen

unread,
Aug 4, 2016, 8:11:05 AM8/4/16
to Ajax.org Cloud9 Editor (Ace)

I am setting the font with($scope.fontSize is a Number): There are some body font settings but looking into the .ace_editor class it looks like the font is set by the following.
 .ace_editor {
  1. positionrelative;
  2. overflowhidden;
  3. font12px/normal 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace;
  4. directionltr;
}

$scope.editor.setOptions({
fontSize: $scope.fontSize,
enableBasicAutocompletion: true,
enableLiveAutocompletion: true,
enableSnippets: true
});

Harutyun Amirjanyan

unread,
Aug 4, 2016, 9:04:36 AM8/4/16
to ace-d...@googlegroups.com
the font in the screenshot doesn't look monospace, also there is some weird padding around tokens
could you please check if problem is present at ace.c9.io?
If ace.c9.io works, issue may be caused by some css in the page, i can help to debug that if you give me url to the page where it happens


Christian Andersen

unread,
Aug 4, 2016, 9:42:22 AM8/4/16
to Ajax.org Cloud9 Editor (Ace)
Unfortunately I am not able to give a url. I changed to courier and am seeing the same issue. Not 100% sure why this would be happening. You mentioed there could be issues when different font sizes are used? Right now I have a body font size and then I set the font size through editorOptions. Could this be an issue?


On Wednesday, August 3, 2016 at 3:38:42 PM UTC-5, Christian Andersen wrote:

Christian Andersen

unread,
Aug 4, 2016, 10:23:34 AM8/4/16
to Ajax.org Cloud9 Editor (Ace)
I also noticed that this bug does not arise if I don't set the ace editor mode to javascript. I'll try with other modes and see what happens


On Wednesday, August 3, 2016 at 3:38:42 PM UTC-5, Christian Andersen wrote:

Christian Andersen

unread,
Aug 4, 2016, 10:56:25 AM8/4/16
to Ajax.org Cloud9 Editor (Ace)
Looks like it only happens when I set a mode for the ace editor.


On Wednesday, August 3, 2016 at 3:38:42 PM UTC-5, Christian Andersen wrote:

Harutyun Amirjanyan

unread,
Aug 4, 2016, 12:32:23 PM8/4/16
to ace-d...@googlegroups.com
could you try to create  a demo page on plnkr.co or jsbin with the same issue
it seems like there is a rule adding padding to tokens generated by the mode.
​You may even find that rule while making the demo page

Christian Andersen

unread,
Aug 17, 2016, 4:56:42 PM8/17/16
to Ajax.org Cloud9 Editor (Ace)
After looking in to this I found a css rule that was affecting the cursor position. Thanks

Madhusudhan Seetharamiah

unread,
May 14, 2018, 2:42:14 PM5/14/18
to Ajax.org Cloud9 Editor (Ace)
can you share the css which was causing the issue. coz i also have similar issue. 
Reply all
Reply to author
Forward
0 new messages