change soft wrap 80 character

3,072 views
Skip to first unread message

Ying Kai

unread,
Jan 2, 2012, 8:20:44 PM1/2/12
to ace-d...@googlegroups.com
Hi all:
   current the soft wrap is set to 80, does anyone know how to change the setting(like to 120)??? I search code for 80 but too much find!!!!!!

Harutyun Amirjanyan

unread,
Jan 3, 2012, 3:16:33 AM1/3/12
to ace-d...@googlegroups.com
kitchen-sink demo is a good place to start searching for stuff :)

https://github.com/ajaxorg/ace/blob/master/demo/kitchen-sink/demo.js#L71
https://github.com/ajaxorg/ace/blob/master/demo/kitchen-sink/demo.js#L377

session.setUseWrapMode(true);
session.setWrapLimitRange(120, 120);

and

session.setUseWrapMode(true);
session.setWrapLimitRange();

for free wrapping

Shawn Brown

unread,
Oct 17, 2014, 2:05:58 AM10/17/14
to ace-d...@googlegroups.com
It works, Thanks.

在 2012年1月3日星期二UTC+8下午4时16分33秒,Harutyun Amirjanyan写道:

Linfeng Li

unread,
Jul 13, 2020, 9:10:44 AM7/13/20
to Ajax.org Cloud9 Editor (Ace)
I want to have 80-char soft wrap for the Ace editor on Overleaf, and have added the suggested configuration to my Greasy Fork script. The diff is linked here and I was adding these two lines:

editor.session.setUseWrapMode(true);
editor.session.setWrapLimitRange(80, 80);

Yet, on Overleaf, after refreshing the page, the softwrap is still set as "free wrapping", I guess? The line only wraps when it hits the full width of the pane. Please advise if there is a GreasyFork way of mandating a softwrap at 80 char? I think is all an end-user can do with Overleaf editors.

Thank you in advance!

Harutyun Amirjanyan

unread,
Jul 13, 2020, 11:55:49 AM7/13/20
to ace-d...@googlegroups.com
perhaps another session is created after your code sets wrap to 80
try using the following

editor.setOption("wrap", 80)  
ace.config.on("session", function(session) {
    session.setOption("wrap", 80)
})

Linfeng Li

unread,
Jul 13, 2020, 12:23:26 PM7/13/20
to Ajax.org Cloud9 Editor (Ace)
It worked! Thanks a lot! Here is a pointer to the full script for Overleaf Vim-mode.

Linfeng Li

unread,
Jul 14, 2020, 9:10:16 AM7/14/20
to Ajax.org Cloud9 Editor (Ace)
Just found one caveat for the Overleaf site: with the following configuration to soft-wrap at column 80, the native "auto-completion" feature is no longer available. 

ace.config.on("session", function(session) {
    session.setOption("wrap", 80)
})

Normally, the auto-completion works like the following, for example. 


I guess this is more an Overleaf-specific issue and will update here if I hear back from their support team.

On Monday, July 13, 2020 at 11:55:49 AM UTC-4 amirj...@gmail.com wrote:
Message has been deleted

Linfeng Li

unread,
Jul 14, 2020, 4:26:30 PM7/14/20
to Ajax.org Cloud9 Editor (Ace)
Update from Overleaf Support:

The following can set a soft-wrap at the 80th col and does not seem to interfere with the auto-completion feature.

editor.setOption("wrap", 80)  
ace.config.on("session", function(session) {
    session.setWrapLimitRange(80, 80)
})
Reply all
Reply to author
Forward
0 new messages