Truly soft wrap at preferred line length


#1

Currently if you enable the options “soft wrap” and “soft wrap at preferred line length” they are wrapped correctly when the editor width is bigger enough, but if it’s smaller they get wrapped at editor width. Shouldn’t it wrap on the preferred line length always, showing an horizontal scroll if it’s too small to get the desired number of characters per line?

I have been using the Dev Inspector and seems the horizontal scrollbar can be enabled, but instead the wrapped lines are in fact several lines (wtf!!!) instead of one with multiple rows. I think maybe this thing would be the point why it’s not working as expected (or at least a huge improvement in internal document html structure…).


#2

I don’t think it should. The intent of a soft wrap feature is to keep the text inside the window (pane, view, whatever) and ultimately prevent the need to scroll horizontally. This version of soft wrap goes an extra step and prevents it from going the full width of the window if your window is too wide, making reading a body of text unwieldy.


#3

Ok, it makes sense… it’s only I’m not used to line wrapping in source code, only on plain text (and I’m giving up from that bad attitude now that I’m writting so much markdown files! :stuck_out_tongue: ).

Ok, so I’ll rewrite my question: is there any way to only have enabled that extra step and only have line wrapping for the desired line lenght, allowing to do horizontal scroll when the panel width is smaller? When viewing code in split panel, the width of each one is smaller than my desired 80 columns, so when it does the line wrapping I’m not truly sure it’s due to the desired line lenght or the panel width… :-/


#4

I think this is the key here. I don’t think anyone is used to soft wrap in source code. But a text editor isn’t just for source code as you mentioned.

And to answer your question, the way to achieve that would be to hard wrap lines. There is an autoflow command that will hard wrap any selection to your preferred line length. This is from the Autoflow package.


#5

So maybe it would makes sense not wrap source code files?

Seems it modify the source code… That’s not what I’m looking for, I only want to have it wrap at 80 columns on the editor viewer, not on the source code itself (I’ll do it myself if I need it). The only thing I can think is to disable line wrapping and add some stiles to the lines (maybe a package, too? :smile: )


#6

That’s correct. I set my environment to soft-wrap text files like Markdown, but to not wrap source code in any way. I suspect this is the norm.


#7

How did you do that?


#8

There are a few packages that offer this kind of functionality. One of them is the Overrides package that @thomasjo and I have been working on.


#9

I’ve tryed your overrides package and it’s useful (specially the point of being able to define diferent tabLengths for each file type), but it’s not fixing the problem of the line wrapping. I’ll try to look for some time and create a package for it myself :smile:


#10

Second this notion. Please re-open: https://github.com/atom/atom/issues/11303