Bug 117336 - Soft word wrap is really necessary
Summary: Soft word wrap is really necessary
Status: RESOLVED FIXED
Alias: None
Product: kmail
Classification: Applications
Component: composer (show other bugs)
Version: 1.9
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-11-30 09:16 UTC by gsasha
Modified: 2008-02-20 11:01 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
soft-break.patch (1.19 KB, patch)
2008-02-20 04:50 UTC, Matt Whitlock
Details

Note You need to log in before you can comment on or make changes to this bug.
Description gsasha 2005-11-30 09:16:46 UTC
Version:           1.9 (using KDE 3.5.0, Kubuntu Package 4:3.5.0-0ubuntu0breezy1 breezy)
Compiler:          Target: i486-linux-gnu
OS:                Linux (i686) release 2.6.12-10-386

The current implementation of the semi-hard word wrap works OK for plain-text emails, it is wrong for HTML-formatted ones.

For an example, consider having two paragraphs, one in font 10, another in font 32. The first will appear to have normal width, and the second will become huge (even worse results occur when mixing letters of different fonts in the same para).

I suggest adding the "soft word wrap to window width" as an option in addition to the current semi-hard word wrap - from reading the Bugzilla, I see there are people who appear to prefer this way. Including me :)
Comment 1 Matt Whitlock 2008-02-20 04:50:42 UTC
Created attachment 23628 [details]
soft-break.patch

I disagree with the reporter's opinion that the current implementation is
adequate for plain-text mail.

Currently we have two options: word wrap at X columns or do not wrap.

The former case behaves correctly (and actually better than most mail clients)
in that What You See Is What You Get in the composer window.  (Kudos.)

The latter case is problematic: the actual mail is sent correctly, but the
QTextEdit widget in the composer window has its wrapping mode set to NoWrap,
which means long lines run right off the edge of the widget and instigate a
horizontal scroll bar.	(Ugly and unusable.)

Simply changing the line wrap mode of the editor to WidgetWidth does not
completely solve the problem because the code that breaks the lines for actual
transmission relies on the editor's wrapping.  So what happens is that the
actually transmitted lines get hard-broken wherever the editor widget put soft
line breaks, which depends on its current graphical width.

Fortunately, the message composer already has a mechanism to suppress the
breaking behavior, although it appears that over the course of several code
revisions, it has become disused.  However, that mechanism could potentially be
invoked when sending a message when the composer's "Word Wrap" option has been
turned off.

The attached patch, therefore, makes the following four changes:
1.) When initially setting up the editor component, set its word wrap mode to
QTextEdit::WidgetWidth instead of QTextEdit::NoWrap if the global word wrap
option is not selected.
2.) When toggling the local word wrap mode (from the Options menu in the
composer window), switch the editor's word wrap mode to QTextEdit::WidgetWidth
instead of QTextEdit::NoWrap when deselecting word wrap.
3.) When copying parameters from the composer window to the message composer,
do not force the mDisableBreaking flag to false.
4.) Instead, set the mDisableBreaking flag iff the composer window's editor
component's word wrap mode is QTextEdit::WidgetWidth.
Comment 2 Till Adam 2008-02-20 11:01:08 UTC
Matt, thanks for the patch, I've implemented this almost exactly like you describe a while back in enterprise branch, and it's now in 3.5.9. Please test there and confirm it works as expected for you now. Cheers.
Comment 3 Till Adam 2008-02-20 11:01:27 UTC
*** Bug has been marked as fixed ***.