jEdit Community - Resources for users of the jEdit Text Editor
Indenting of continuation lines specifiable by user
Submitted by a992400 on Monday, 24 October, 2005 - 04:59

Currently, jEdit does soft wrapping of long paragraphs so that the continuation lines (second, third, etc.) are indented to the same level as the first line of the paragraph. For example, if the paragraph is indented four spaces, then all continuation lines are also indented four spaces (using underscores as spaces in my examples):

    First line of long and wrapped paragraph...
    second line of same paragraph...
    third line...

However, there are many cases in which it would be nice to have all of the continuation lines indented to a different level than the first line. For example, most business correspondence is now formatted so that each paragraph has no indentation, and is separated from other paragraphs with one blank line. But many writers and editors still like the more traditional style, in which the paragraph is indented five spaces, and all continuation lines of that paragraph are not indented at all:

[Example #2:]

    First line of long and wrapped paragraph...
second line of same paragraph...
third line...

Another common example is source code whose lines extend past the right margin of the screen, and thus get wrapped:

    First line of first long and wrapped source code statement...
    second line of same code statement...
    third line...
    First line of second long and wrapped source code statement...
    second line of second code statement...

Far more readable would be (indenting continuation lines with four extra spaces):

    First line of first long and wrapped source code statement...
        second line of same code statement...
        third line...
    First line of second long and wrapped source code statement...
        second line of second code statement...

or my favorite: indenting continuation lines with eight extra spaces -- to distinguish them from lower block levels:

[Example #5:]

    First line of first long and wrapped source code statement...
            second line of same code statement...
            third line...
    First line of second long and wrapped source code statement...
            second line of second code statement...

Traditionally this wrapping of long source lines has been done with "hard wrapping" (i.e., inserting carriage return/newline pairs to force the wrapping), often with a limit of 80 characters per line, so all of the code fit on the screen, with none of it disappearing past the right margin. But now that programmer's editors are getting smarter, and allow soft word wrapping, it would be great if jEdit could allow the user to specify the number of spaces that the continuation lines should be indented relative to the first line (i.e., the indentation of the paragraph as a whole). For instance, in my Example #2, the user would indent the paragraph five spaces, and specify -5 (negative five) as the indentation for continuation lines. In Example #5, indentation of continuation lines would be set to 8. Setting the value to 0 (zero) would of course result in all of the lines of the paragraph lining up vertically. So far, I've been thinking of the indentation setting to be a relative value (i.e., relative to the indentation of the first line). Even better would be the option of specifying either a relative value, or an absolute value. For instance, an absolute value of 4 would cause all continuation lines to be indented four spaces, regardless of the indentation of the first line. I can imagine a number of scenarios in which that would be very useful.

Comment viewing options
Select your preferred way to display the comments and click 'Save settings' to activate your changes.
I really second that. Is ther
by spacebear on Mon, 17/04/2006 - 15:14
I really second that. Is there any way to do this as a plugin? Or will this be available in a future version?
User login
Browse archives
« April 2024  
MoTuWeThFrSaSu
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
 
Poll
Are you interested in language packs for jEdit?
Yes, and I could help maintain translations
26%
Yes, I'd like to have translations
32%
Indifferent
35%
No, that'd be bad (please comment)
7%
Total votes: 1093
Syndication
file   ver   dls
German Localization light   4.4.2.1   82349
Context Free Art (*.cfdg)   0.31   46055
BBEdit scheme   1.0   18595
JBuilder scheme   .001   18495
ColdFusion scheme   1.0   18024
R Edit Mode - extensive version   0.1   17473
Advanced HTML edit mode   1.0   16206
Matlab Edit Mode   1.0   16068
jEdit XP icons   1.0   15229
XP icons for jEdit   1.1   14293