最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Remove word-wrap offset in ACE editor - Stack Overflow

programmeradmin12浏览0评论

I need to remove offseting 4 " " which are automatically created after breaking line in ACE editor

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. 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

Any idea how to get rid of those 4 spaces?

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

I need to remove offseting 4 " " which are automatically created after breaking line in ACE editor

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. 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

Any idea how to get rid of those 4 spaces?

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");
Share Improve this question edited Jul 12, 2016 at 8:30 asked Jul 12, 2016 at 8:17 user704565user704565
Add a comment  | 

1 Answer 1

Reset to default 17

This is controlled by indentedSoftWrap setting in ace, you cn turn it off by running

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"
});
发布评论

评论列表(0)

  1. 暂无评论