简体   繁体   English

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

[英]Remove word-wrap offset in ACE editor

I need to remove offseting 4 " " which are automatically created after breaking line in ACE editor 我需要删除在ACE编辑器中断行后自动创建的offseting 4“”

I tried using editor.setTabSize(0) that worked as well, but then I can't ident code by using TAB, as it throws "undefined" instead into code. 我尝试使用editor.setTabSize(0) ,但后来我无法通过使用TAB识别代码,因为它将“undefined”引入代码中。 I searched on ACE webpage, but there is nothing as that, and when searched forums, it told something with setBehaviosrEnabled , but that didn't work either 我在ACE网页上搜索过,但没有那样的东西,当搜索论坛时,它用setBehaviosrEnabled告诉了一些东西,但是这个也setBehaviosrEnabled

Any idea how to get rid of those 4 spaces? 知道如何摆脱这4个空间吗?

Issue: 问题: 在此输入图像描述

Code: 码:

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");

This is controlled by indentedSoftWrap setting in ace, you cn turn it off by running 这是由ace中的indentedSoftWrap设置控制的,你可以通过运行将其关闭

editor.setOption("indentedSoftWrap", false);

behaviours setting is completely unrelated and controls automatic insertion of closing brackets and tags. 行为设置完全不相关,并控制关闭括号和标签的自动插入。

So your code from the above would become 所以你上面的代码就会变成

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"
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM