在ACE编辑器中删除自动换行偏移量

jak*_*inf 2 javascript word-wrap ace-editor

我需要删除在ACE编辑器中断行后自动创建的offseting 4""

我尝试使用editor.setTabSize(0)它也有效,但后来我无法通过使用TAB识别代码,因为它将"未定义"引入代码.我在ACE网页上搜索过,但没有那样的东西,当搜索论坛时,它告诉了一些东西setBehaviosrEnabled,但这也没有用

知道如何摆脱这4个空间吗?

问题: 在此输入图像描述

码:

var editor = ace.edit("edittext");
editor.setOptions({
    maxLines: Infinity
});
editor.getSession().setUseWrapMode(true);
editor.setBehavioursEnabled(false);
editor.renderer.setOption('showLineNumbers', false);
editor.setTheme("ace/theme/xcode");
Run Code Online (Sandbox Code Playgroud)

a u*_*ser 8

这是由ace中的indentedSoftWrap设置控制的,你可以通过运行将其关闭

editor.setOption("indentedSoftWrap", false);
Run Code Online (Sandbox Code Playgroud)

行为设置完全不相关,并控制关闭括号和标签的自动插入.

所以你上面的代码就会变成

var editor = ace.edit("edittext");
editor.setOptions({
    maxLines: Infinity,  // this is going to be very slow on large documents
    useWrapMode: true,   // wrap text to view
    indentedSoftWrap: false, 
    behavioursEnabled: false, // disable autopairing of brackets and tags
    showLineNumbers: false, // hide the gutter
    theme: "ace/theme/xcode"
});
Run Code Online (Sandbox Code Playgroud)