Bug 88796 - Add linebreak normalization function ("fill-paragraph")
Summary: Add linebreak normalization function ("fill-paragraph")
Status: CONFIRMED
Alias: None
Product: kile
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: RedHat Enterprise Linux Linux
: NOR wishlist
Target Milestone: ---
Assignee: Jeroen Wijnhout
URL:
Keywords:
: 89568 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-09-03 22:00 UTC by kde2eran
Modified: 2006-01-08 21:35 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description kde2eran 2004-09-03 22:00:59 UTC
Version:           1.6.3 (using KDE KDE 3.2.2)
Installed from:    RedHat RPMs
OS:                Linux

When TeX files are exchanged between authors or edited with external tools, it is often important that they have nice linebreaks, rather than relying on dynamic word-wrap. Ideally, each paragraph should be canonically word-wrapped (in the natural sense) to some given margins.

Kile's "static word wrap" option helps achieving this for newly written text, but not for imported text or for text being edited.

Emacs has a nice "fill-paragraph" function (by default bound to Meta-Q), which normalizes the whitespace and linebreaks in the current paragraph. The right margin is given by a configurable variable. The left margin is automatically determined according to the first line in the paragraph (i.e., the whitespaces preceeding the first non-whitespace in the first line are copied to all subsequent lines). 

I suggest adding this function to kile. If there is an active selection, normalize all paragraphs inside this selection (or perhaps only the portions of paragraphs that are within the selection). Otherwise, normalize the current paragraph (without the need to first select it).

Note that determining what's a paragraph requires some TeX-specific heuristics; for example, most people will want $$ at the beginning of a line to start a new paragraph for the purpose of word wrapping. Maybe this is best left configurable as a regexp.

After normalization, the cursor should be placed at the end of the normalized paragraph (as in emacs), to make it easy to move down to the the next paragraph when normalizing paragraphs one by one manually.
Comment 1 Pascal Crépey 2004-09-10 15:37:38 UTC
I agree with you on the fact that this feature is missing. 
You can try to use the "merge line" function with the 
"static word wrap" instead but it's not really satisfying 
since it does not substitute a white space to the line break 
it has erased... consequently you end up with well wrapped 
paragraph but with "ZiAi+1" on all your lines
(Zi for the last word of line 1, Ai+1 for the first line i+1).
Comment 2 Thomas Braun 2006-01-08 21:35:53 UTC
*** Bug 89568 has been marked as a duplicate of this bug. ***