Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hard wrap support #2865

Closed
whut opened this issue Jan 27, 2016 · 9 comments
Closed

Hard wrap support #2865

whut opened this issue Jan 27, 2016 · 9 comments

Comments

@whut
Copy link

whut commented Jan 27, 2016

ACE already have soft wrap support, but please add hard wrap also.

CodeMirror already have it: https://codemirror.net/demo/hardwrap.html

@nightwing
Copy link
Member

The one from codemirror interferes with undo/redo in a rather bad way. Do you know of any other editors implementing this feature?
Also should it automatically rewrap after pasting text?

@whut
Copy link
Author

whut commented Feb 6, 2016

For JS-based editors I know that Atom editor have the autoflow plugin, it does not "live" hard wrap, but at least a keyboard shortcut to wrap selected text or current paragraph.

For others, I believe that vim have this nicely handled. It wraps text as you type, but only at the point of cursor. This way it handles the most common situation easly and hopefully in a way that could be implemented in JS without performance problems. But if you start typing inside an already written paragraph it will not "reflow" the whole paragraph, but just wrap when your new text will pass the maximum column. Also if you start typing in the middle of an already written line it will wrap where you enter new text, and the already written text on the right will overlap. Also there are shortcuts to force re-wrap. It also preserves indentation, so if you start paragraph indented wrapping will preserve it. This is really.

Vim wraps pasted text, if you do not want it you must temporary disable wrapping.

Also the Eclipse dialog for entering Git commit messages wraps text automatically, including pasted text, additionally "reflowing" if writing inside other line. I do not even know if it can be disabled,2

@whut
Copy link
Author

whut commented Feb 15, 2016

Also GitHub Desktop does hardwrap at 72 char, with "reflow" and wrapping pasted text.

@sebhahn
Copy link

sebhahn commented Apr 6, 2020

Could someone comment on the plans of this feature?

@nro-bot
Copy link

nro-bot commented May 24, 2021

Ditto, would love to hard warp in overleaf with uses Ace editor. I'm not used to vim keyboard shortcuts for end of visual line etc. :'( Now I just skip vim mode when writing which is most of the time

@nightwing
Copy link
Member

#4545 adds initial support for vim gq command it doesn't handle the comments formatoptions+=t the way vim does, but not sure if that is needed or not.
If someone tries it https://raw.githack.com/ajaxorg/ace/vim-hardwrap/kitchen-sink.html we can further imrpove it or add the needed features.

@xdhmoore
Copy link

xdhmoore commented Aug 27, 2021

@nightwing I also came here looking for a fix for overleaf. It's awkward to be used to hit j or k and skip over the text you want cause it's soft-wrapped. gq would be useful.

Your fix seems to solve my simple use case, which is just selecting a long line and hard wrapping it. So, seems useful to me, for whatever that's worth.

@whazor
Copy link
Contributor

whazor commented Mar 2, 2023

We understand that hard wrapping feature would be nice for some people to have. This could come a new 'extension' under Ace.

However, compared to all the other bugs and feature requests, this feature request would have low priority. Feel free to create a PR though.

@whazor
Copy link
Contributor

whazor commented Mar 2, 2023

Ah, I did not notice, but we have a hardwrap.js in ext/. So import ext/hardwrap.js and add:

hardWrap(editor, {column: 20, startRow: 0, endRow: 1000});

@whazor whazor closed this as completed Mar 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants