Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#255 add a wrap mode that recognize trailing space before EOL

v5.2
open
nobody
Edit mode (23)
5
2013-12-09
2008-11-13
Zhang Weiwu
No

Hi. In vim there is a formating option "w". Quote from vim online help:

Trailing white space indicates a paragraph continues in the next line. A line that ends in a non-white character ends a paragraph.

This format option is often (99%) used together with another "auto-format" option, the effect is explained here:
If I have the following text with 35 character hard line-wrap and have "w" option enabled, the text look like this: (where spaces are replaced with _ to be more clear)
0 +--------------------------------+
1 |The_quick_fox_jumps_over_a_lazy_|
2 |dog._The_quick_fox_jumps_over_a_|
3 |lazy_dog. |
4 | |
5 |And_again_another_quick_fox. |
6 +--------------------------------+

Here is the good thing about it: if I remove the word "lazy" from line 1, in VIM it become like this:

0 +--------------------------------+
1 |The_quick_fox_jumps_over_a_dog._|
2 |The_quick_fox_jumps_over_a_lazy_|
3 |dog. |
4 | |
5 |And_again_another_quick_fox. |
6 +--------------------------------+

VIM recognizes line 2 is actually part of the same paragraph, because line 1 has a space before EOL. This way it always maintain the whole paragraph properly line-wrapped

.JEDIT does it differently. After removed "lazy" in line 1, it becomes:

0 +--------------------------------+
1 |The_quick_fox_jumps_over_a_ |
2 |dog._The_quick_fox_jumps_over_a_|
3 |lazy_dog. |
4 | |
5 |And_again_another_quick_fox. |
6 +--------------------------------+

This request is to request jEdit to implement an option, besides soft warp and hard warp, add another wrapping mode to be compatible with VIM. Reason:

1) that way I and people like me can work comfortably with my colleague in a team exchanging document using version control software. especially on roff documents and tex documents
.2) this method itself is not bad. It is transparent to a lot other applications (because the trailing white space is not visible). The alternative method, using double EOL to represent paragraph break, is not flexible enough in case of list items (where people prefer not to insert a blank line between list items), poems and some mark up text (roff documents for example)
.3) that gives people who doesn't want to use soft-warp an alternative choice that maintain text editable with hard line-warp. People try to avoid soft-warp in a lot of reasons, one reason is to make the text easier to work with console tools li ke 'grep' (a very long line makes 'grep' output hard to read)

Discussion

  • Zhang Weiwu
    Zhang Weiwu
    2008-11-13

    You must read the above with a fixed-width font in order to see what I mean.