Hard line wrapping


#1

Hi

FoldingText does not save the line break it inserts into the text when it displays a text with respect to the select text wrap width. For example if one selects a text wrap width of 60 characters each displayed line of text has 60 characters at most. But when you save the text these soft line breaks will not be saved to a file. This is a bit annoying if you want to add your text files to a version control system like a git-repository. The differences between two versions are normally computed on line based manner. Therefore it becomes hard to keep track of the differences when each line consists of an entire paragraph. So I would like have something like hard line break that is the possibility to save a text with all displayed line breaks.

Ciao

Maral


#2

Maral,

I think this is beyond the scope of what FoldingText’s meant to do. The “wrap” in this case is only intended to be a visual wrap. Encoding it properly in the file format with hard wraps would be fairly complex and error prone I think.

Jesse


#3

Just wanted to say this is a bit disappointing, in terms of Markdown interoperability. The Markdown spec offers this example of wrapping lines in a list:

*   Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
    Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,
    viverra nec, fringilla in, laoreet vitae, risus.
*   Donec sit amet nisl. Aliquam semper ipsum sit amet velit.
    Suspendisse id sem consectetuer libero luctus adipiscing.

If I save that in a file, FoldingText can load it, and it looks nice:

But there doesn’t seem to be any way to create that formatting from inside FoldingText. Visual wrap looks nice as long as you’re in FoldingText, but if you save a visually wrapped file and then view it in a terminal (or MacVim), it’s ugly:

I know you said encoding hard wraps in the file would be difficult, and you’re probably right. But given that Markdown supports the newline character as line wrap, and that FoldingText loads and displays that format just fine, it would be lovely if it could save it as well.


#4

Hi,

Thank you for writing in. I think the original question was a little different in the sense that they wanted FoldingText to hard-wrap the text as it was laid out in the editor.

What you’re asking should be doable within FoldingText. The way to enter a hard line-break is by pressing Shift-Enter and it should work. However, the hard line-break isn’t really suited to FoldingText, and thus might have unexpected results in terms of formatting and layout from what you expect. The reason is that the hard-line break makes a ‘new line’ whereas the visual line breaks are still one line and FoldingText lays them automatically.

Also, the syntax FoldingText uses isn’t Markdown, it just borrows some (a lot? :smirk: ) semantics from it. One big departure is how FoldingText deals with indentation: Markdown is basically flat, with the only exception being made for hierarchical lists. FoldingText on the other hand is all about hierarchy, you can make anything a child of anything else.

Regards,
Mutahhir


#5

Thanks for the explanation. I think if shift-return inserted spaces to the current indentation level, that might do what I want. But it might not be right for FoldingText’s indentation model. Now that I understand it’s not Markdown but a close relative, this makes more sense.