Ace Trucating Leading Spaces

17 views
Skip to first unread message

Michael Petrovich

unread,
Dec 4, 2022, 11:05:10 AM12/4/22
to Ajax.org Cloud9 Editor (Ace)
I have an instance where all the leading spaces are removed.  I have never seen this problem.  I have a page with two instances.  One works fine and the does not.  I cannot replicate this for you, because I do not know what is causing it.  I also use Ace Editor for many other uses, but I have never seen this problem.

When a file is read and the contents are added to the editor, all the leading spaces are removed. I can verify the the leading spaces are in the file, and can verify the leading spaces exist before adding to the editor. 

I do not know where to begin debugging.  I can replace characters to show where the spaces should be.

One change was I went to 1.13.1.  It worked fine before then.

Harutyun Amirjanyan

unread,
Dec 4, 2022, 11:11:53 AM12/4/22
to ace-d...@googlegroups.com
Do you use editor.setValue or let the editor to read from dom?

Michael Petrovich

unread,
Dec 4, 2022, 4:00:20 PM12/4/22
to Ajax.org Cloud9 Editor (Ace)
    ace.config.set('basePath', AceEditorPath);
    aceEditorT = ace.edit('aceTTEXT');
    aceEditorT.setTheme('ace/theme/twilight');
    aceEditorT.container.style.background='black';
    aceEditorT.getSession().setMode('ace/mode/php');
    aceEditorT.setShowPrintMargin(false);
    aceEditorT.getSession().setUseWrapMode(true);

I am reading a file and setting it in the DIV. 
<div id="aceTTEXT">$TTEXT</div>

I have been working on this for hours and have tried many things.  The page has two editors.  The other works fine, and this one stopped working in the last couple of days.  The code is identical.  It is kind of like the DIV has a text-align:left.  I can insert a character before the line and the indents will be fine.  I can do a string replacement on spaces and have that work.  Now, I am just into trial and error.

Michael Petrovich

unread,
Dec 4, 2022, 9:24:21 PM12/4/22
to Ajax.org Cloud9 Editor (Ace)
Fixed.  I knew there must have been something stupid.  I was feeding this into my code processing function designed to remove the leading spaces of other code.  While formatting the other code, I also was formatting my Ace content.  Not too wise.  It now works.
Reply all
Reply to author
Forward
0 new messages