Skip to content
This repository has been archived by the owner on Aug 6, 2021. It is now read-only.

Disable word-wrapping in editor #223

Closed
ELLIOTTCABLE opened this issue Feb 1, 2016 · 39 comments
Closed

Disable word-wrapping in editor #223

ELLIOTTCABLE opened this issue Feb 1, 2016 · 39 comments

Comments

@ELLIOTTCABLE
Copy link

So, I often work on small laptop screens; and I also prefer my code (including LaTeX documents) hard-wrapped (at 100 columns, for whatever it's worth.)

This isn't playing too well with the ShareLaTeX editor: I was shocked to see vim-command support, and that's really exciting; so I have high hopes that perhaps I could convince you to offer a flag to disable Ace's soft-wrapping entirely?

@mgranvik
Copy link

I second this suggestion. Although it seems a small issue, the soft-wrapping makes me walk away from sharelatex.

@paolieri
Copy link

I second this suggestion as well. Hard-wrapping is very important if you synchronize to GitHub and want to be able to check git diff outputs. With soft-wrapping, it's very hard to check what changed in a line. Many collaborators lamented this. Also: I think it should be a project setting, not a user one.

@jpallen
Copy link
Contributor

jpallen commented Jul 25, 2017

This isn't on our roadmap because we're always very cautious about adding more and more settings when the defaults work well for people, but I'll leave this open as an ongoing gauge of interest

@paolieri
Copy link

That is indeed a good policy!

But I think that this would be a very important feature. Merge and diff algorithms are line-oriented; if you put an entire paragraph on one line, you make those tasks much more difficult. Especially when collaborating with authors that use their own editor and git instead of the online one (the "track changes" feature in the online editor makes this easier).

I can help with the implementation if this feature is added to the roadmap. Meanwhile, a temporary solution is to use git diff --word-diff.

@bradjc
Copy link

bradjc commented May 8, 2018

I certainly support this feature. In particular, soft wrapping makes working with tables with many columns challenging. I can only make my browser window so wide.

@mlaneuville
Copy link

I would also very much like that feature for the reasons above.

@moorepants
Copy link

I support hard wrapping. Soft wraps pretty much make navigation to specific locations very difficult. Hard wraps are needed for vim-mode.

@brianlarkins
Copy link

another vote for hard wrapping. cut/paste can be awful with vim-mode.

@glavrentiadis
Copy link

I would also support this feature for the reasons mentioned above

@quebin31
Copy link

Hard wrapping would be really cool, currently working with Vim mode is awful.

@heshameraqi
Copy link

heshameraqi commented Jul 29, 2019

Tables are completely messed up without this feature. Please add it.

@juanfung
Copy link

juanfung commented Aug 1, 2019

Agree 100% about disabling soft wrapping and supporting hard wrapping! Hard wrapping is especially important, for all the reasons already mentioned

@tomekjaworski
Copy link

Such editor line wrapping configuration would be very helpful.

@tooHotSpot
Copy link

Very important for laptops. I agree with above.

@chrisjsewell
Copy link

+1

@PatricioClark
Copy link

Yes, please 👍

@sebhahn
Copy link

sebhahn commented Apr 4, 2020

What is the current status on this feature?

@NilsEnevoldsen
Copy link

Workaround

Use this bookmarklet:

javascript:ace.edit($(".ace-editor-body")[0]).getSession().setUseWrapMode(false);

@sebhahn
Copy link

sebhahn commented Apr 5, 2020

@NilsEnevoldsen how to set e.g. 80 chars for hardwrap?

@NilsEnevoldsen
Copy link

@sebhahn Hard wrapping is not supported with the Ace editor (ajaxorg/ace#2865). I don't know if character wrapping is supported.

You can set 80-character-width soft word wrap with this bookmarklet:

javascript:ace.edit($(".ace-editor-body")[0]).getSession().setWrapLimitRange(80,80);

@Kee-Wang
Copy link

Kee-Wang commented Jul 24, 2020

Workaround

Use this bookmarklet:

javascript:ace.edit($(".ace-editor-body")[0]).getSession().setUseWrapMode(false);

This saved my day! Thanks!
For those who has zero knowledge (such as I did) about booklet, here is the example about how to do it in Chrome:

  1. Create a new bookmark and fill the Name and URL as following:

  2. Name: NoWrapInOverleaf (or what ever name suits you)

  3. URL: javascript:ace.edit($(".ace-editor-body")[0]).getSession().setUseWrapMode(false);

  4. Save the bookmark. Now turn to your Overleaf page that has the text editor. Click the bookmark you just saved. Now you should be able to see texts in the editor are no longer wrapped.

The URL basically tells the browser to execute the Javescript code which asks the online text editor (Ace) to turn off wrap mode. To turn the wrap mode back, simply refresh the page.

@Lorentz-Ipsum
Copy link

This saved my day! Thanks!
For those who has zero knowledge (such as I did) about booklet, here is the example about how to do it in Chrome:

This method also works on Firefox.

It is such a useful feature I would love to see an option to enable/disable it on the Settings sidebar.

@aharwood2
Copy link

Bump -- this would be awesome.

@bluewww
Copy link

bluewww commented Sep 12, 2020

dito

@adamconkey
Copy link

I would benefit from hard wraps. I collaborate with someone using emacs (not in overleaf) and they hard wrap everything, so when I pull the changes in overleaf it's a mess.

@i-abr
Copy link

i-abr commented Oct 26, 2020

Agreed, hard wrap would make me want to use overleaf a lot more.

@mcamurri
Copy link

mcamurri commented Oct 29, 2020

Same here, please

@Jerry-Ma
Copy link

Jerry-Ma commented Nov 28, 2020

I have been using vim and hard wrapping for my tex editting, and just now I tried using overleaf the first time, and immediately identified this barrier.

I would have definitely turned to overleaf from now on if this feature were in place.

@berghaus
Copy link

Would be appreciated. Note the workaround posted by @NilsEnevoldsen and explained by @Kee-Wang above

@luiarthur
Copy link

Yes, would love hard wrapping as a vim user.

@qudsiramiz
Copy link

Workaround

Use this bookmarklet:
javascript:ace.edit($(".ace-editor-body")[0]).getSession().setUseWrapMode(false);

This saved my day! Thanks!
For those who has zero knowledge (such as I did) about booklet, here is the example about how to do it in Chrome:

  1. Create a new bookmark and fill the Name and URL as following:
  2. Name: NoWrapInOverleaf (or what ever name suits you)
  3. URL: javascript:ace.edit($(".ace-editor-body")[0]).getSession().setUseWrapMode(false);
  4. Save the bookmark. Now turn to your Overleaf page that has the text editor. Click the bookmark you just saved. Now you should be able to see texts in the editor are no longer wrapped.

The URL basically tells the browser to execute the Javescript code which asks the online text editor (Ace) to turn off wrap mode. To turn the wrap mode back, simply refresh the page.

Kinda sad that the workaround doesn't work for Microsoft Edge. Any suggestion?

@dbogatov
Copy link

dbogatov commented Jan 29, 2021

We always have an option to go to the javascript console (in Safari, for example, it's Develop -> Show JavaScript Console) and insert the script manually (copy-paste and hit Enter).

Don't copy-paste javascript: part.
ace.edit($(".ace-editor-body")[0]).getSession().setUseWrapMode(false);

But I do ask the developers to have this as an option in UI.

@chrstfer
Copy link

The editor works very well overall on mobile (in both firefox beta for android and the Fennec firefox build for android), but unfortunately I don't know of any way to apply the workaround. It would really be nice to have this as a UI option.

Long-shot related suggestion: add emacs's "fill-paragraph" and "fill-region" as keybinds for emacs mode.

@NovaFlint
Copy link

If you want that bookmarklet to work as a toggle, you can use javascript:(()=>{let s=ace.edit($(".ace-editor-body")[0]).getSession();s.setUseWrapMode(!s.$useWrapMode)})()

@tillahoffmann
Copy link

If you've got TamperMonkey installed, the following user script will add a button to toggle text wrapping to the toolbar.

// ==UserScript==
// @name         Overleaf customisation.
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        https://www.overleaf.com/project/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    setTimeout(function () {
        var toolbar = document.querySelector('div.toolbar-editor > div.toolbar-right');
        var element = document.createElement('A');
        element.textContent = 'Toggle wrap';
        element.onclick = function() {
            var editor = document.querySelector('.ace-editor-body');
            let session = ace.edit(editor).getSession();
            session.setUseWrapMode(!session.$useWrapMode)
        };
        toolbar.insertBefore(element, toolbar.children[0]);
    }, 3000);
})();

@dbogatov
Copy link

@tillahoffmann , great (temporary) solution!

Hey, devs, apparently, it will take you the entire couple lines of JS code to make life easier for us!
How did you even imagine people working with large tables in web editor with wrapping?

@chrstfer
Copy link

@tillahoffmann would you be interested in integrating that into the official client and submitting a PR?

@tillahoffmann
Copy link

@chrstfer, I'm unfortunately not a competent web developer, but anyone who has the skills to integrate it into the codebase is welcome to use whatever is useful from the snippet above.

@das7pad
Copy link
Member

das7pad commented Aug 6, 2021

Hi!

Thank you for taking the time to write up this issue.

We are in the process of migrating to a monorepo at https://github.com/overleaf/overleaf and will mark this repository read-only soon.
You can read more about the monorepo migration at overleaf/overleaf#923.

We are going to close this issue now to avoid any confusion about the inability to comment further.

If you believe this issue still needs addressing, please create a new issue at https://github.com/overleaf/overleaf.

Thanks again!

@das7pad das7pad closed this as completed Aug 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests