Bug 288882

Summary: Wrapping behavior in Composer depending on window size & no auto-break upon send
Product: [Applications] kmail2 Reporter: Georg Greve <greve>
Component: composerAssignee: kdepim bugs <kdepim-bugs>
Status: RESOLVED FIXED    
Severity: wishlist CC: glua, kde, martin.tlustos, montel, research, silver.salonen, t-weiblen, tasbeak, vayu
Priority: NOR    
Version: 4.7   
Target Milestone: ---   
Platform: Fedora RPMs   
OS: Linux   
Latest Commit: Version Fixed In: 4.9.2
Sentry Crash Report:
Attachments: fix

Description Georg Greve 2011-12-13 11:16:41 UTC
Version:           4.7 (using KDE 4.7.3) 
OS:                Linux

Right now there are two settings for the composer:

 (a) Wrap after a fixed number of characters & then convert the wraps into line-breaks upon send, suffering among other things from issue #163609

 (b) Turn off wrapping altogether, in which case the text flows out of the screen & horizontal scrolling becomes necessary

This request is for a third mode:

 (c) Wrap depending upon composer window size (so no horizontal scrolling) and do *not* turn those wraps into breaks upon sending

which would circumvent issue #163609 as well as provide a saner standard/alternative behavior than (b), which really is a special case of (c), IMHO.

Reproducible: Didn't try



Expected Results:  
Composer settings should offer:

 [ ] Automatically break lines longer than [xx] columns
 
and as a potential "expert setting"

 [ ] Turn word-wraps into line-breaks when sending email

although that might be skipped, IMHO, as I am not sure how big this use case really is. The default behavior should be to auto-break after 78 characters, the alternative setting should be to wrap in editor for usability purposes, but not convert those into line-breaks upon send.

Note: Saving emails as drafts or templates needs to inherit these settings, as well.
Comment 1 Martin Tlustos 2012-03-20 08:31:04 UTC
*** Bug 291134 has been marked as a duplicate of this bug. ***
Comment 2 Murz 2012-03-20 09:51:42 UTC
*** This bug has been confirmed by popular vote. ***
Comment 3 xxtobi 2012-03-20 21:20:02 UTC
Please also note bug 284386 which was introduced with 4.7.2 and set to "NOFIX" - despite 200 votes as of today and being a clear regression.
Before 4.7.2, (b) did not exist and (c) was standard - hence both bugs are linked. Mode (c) should definitely be standard (again) if there are no valid use cases for (b). Else, the requested option (as in KWrite) would be nice.
Comment 4 Martin Tlustos 2012-03-21 10:02:03 UTC
Well, most of the developers are working in their spare time and get no pay for developing kmail. Maybe it would help if we set up a donation list or so, so they can get enough time to work on it (it might be a bigger change that's needed for the fix).
I know this is no forum, but people will rather read this post than a forum post... ;-)
Comment 5 Matt Whitlock 2012-08-10 06:08:29 UTC
Created attachment 73078 [details]
fix

Oh, for Pete's sake, this is a two-line change. It's not that hard.

For what it's worth, mode (c) has never been implemented in KMail 2 for as long as I've been using it (which is since it was integrated into the KDE-PIM public release cycle). Formerly, Kmail 2 implemented a mode (d): Wrap depending upon composer window width, and convert wraps to line breaks upon send. There was a bug filed that complained that the placement of the line breaks depended on the composer window width, so the committed "solution" was to stop wrapping at the composer window width, i.e., mode (b). A better complaint, in my opinion, should have been that no artificial line breaks should be inserted into the message whatsoever when the wrapping option is deselected, and that the composer widget should still wrap text *virtually* during editing, i.e., mode (c).

This patch replaces mode (b) with mode (c), which, I believe, resolves all relevant complaints.
Comment 6 L. Rahyen 2012-08-11 17:08:17 UTC
Thanks for the effort, but your patch does not work as expected for me: it implements mode (d). In other words I can write message normally with no horizontal scrolling, but when I press "Send Later" or "Send Mail", virtual newlines are saved like real ones, and this ruins the formatting of the message.

> There was a bug filed that complained that the placement of
> the line breaks depended on the composer window width

In KMail 1.13.7 this worked perfectly. This is the version I was using before upgraded to KMail 2. I could write my message in window of any width, and only newlines inserted in the actual message were newlines I typed myself by pressing Enter (mode (c) ). So this looks like double regression in KMail 2 (as I understand, first regression was introduction of mode (d), then it was "fixed" by replacing it with mode (b) ).

By the way, I tried to look in the code myself a month ago, and, unfortunately, was not able to come up with a fix (was not able to implement mode (c) ). So this isn't easy to fix without KMail-specific knowledge.
Comment 7 Matt Whitlock 2012-08-11 17:13:59 UTC
(In reply to comment #6)
> Thanks for the effort, but your patch does not work as expected for me: it
> implements mode (d). In other words I can write message normally with no
> horizontal scrolling, but when I press "Send Later" or "Send Mail", virtual
> newlines are saved like real ones, and this ruins the formatting of the
> message.

I thought the same thing too at first. I actually wasted over an hour trying to figure out why my two-line change was producing mode (d) and not mode (c). It didn't make sense. Then finally I realized that I had to rebuild and reinstall not only kde-base/kmail but also kde-base/kdepim-common-libs. (I'm on Gentoo.) Once I rebuilt kdepim-common-libs, KMail started working in mode (c).
Comment 8 L. Rahyen 2012-08-11 18:37:11 UTC
> Then finally I realized that I had to rebuild and reinstall
> not only kde-base/kmail but also kde-base/kdepim-common-libs.
Thanks! It's working perfectly now (I wish I realized this when I was trying to fix it myself a month ago).

> KMail started working in mode (c)
It is even better: not only it works as it should now, but also very long URLs with slashes, dashes, "%" and other symbols are not broken and clickable in sent messages (URL I tried was more than 2000 characters long). So, this patch definitely should be committed, it fixes the biggest bug in current KMail 2 without introducing regressions; in other words, it makes the composer usable again.
Comment 9 vayu 2012-08-24 07:32:57 UTC
Any chance anyone know where to get a deb with this patch for kubuntu 12.04?  Or is this something that I can reasonably be directed to do myself?
Comment 10 Myriam Schweingruber 2012-08-25 15:30:25 UTC
(In reply to comment #9)
> Any chance anyone know where to get a deb with this patch for kubuntu 12.04?
> Or is this something that I can reasonably be directed to do myself?

It is in the Kubuntu backports PPA, see http://kubuntu.org/news for more information.
Comment 11 Myriam Schweingruber 2012-08-25 15:33:15 UTC
Oops, looks like I misread totally, please disregard my last comment.

Matt: how about submitting your patch to http://reviewboard.kde.org?
Comment 12 Matt Whitlock 2012-08-25 15:54:08 UTC
(In reply to comment #11)
> Matt: how about submitting your patch to http://reviewboard.kde.org?

Submitted as review request #106180:
https://git.reviewboard.kde.org/r/106180/
Comment 13 Laurent Montel 2012-09-04 05:31:55 UTC
Git commit aa675c2717f9cdf9cb78c7f56afe72606b5ee84d by Montel Laurent.
Committed on 04/09/2012 at 07:29.
Pushed by mlaurent into branch 'KDE/4.9'.

Apply patch from Matt Whitlock <kde@mattwhitlock.name>

Fix Bug 288882 - Wrapping behavior in Composer depending on window size
& no auto-break upon send

FIXED-IN: 4.9.2
REVIEW: 106180

M  +1    -1    kmail/kmcomposewin.cpp
M  +1    -0    messagecomposer/kmeditor.cpp

http://commits.kde.org/kdepim/aa675c2717f9cdf9cb78c7f56afe72606b5ee84d
Comment 14 tasbeak 2012-10-04 21:23:15 UTC
 hallelujah, just got KR4.9.2 - the editor is is wrapping properly again.
Comment 15 vayu 2012-10-05 05:09:28 UTC
Here too. Yes!!!

On Thu Oct 4 09:23:15 PM tasbeak@googlemail.com wrote:
> https://bugs.kde.org/show_bug.cgi?id=288882
> 
> tasbeak@googlemail.com changed:
> 
>            What    |Removed                     |Added
> ----------------------------------------------------------------------------
>                  CC|                            |tasbeak@googlemail.com
> 
> --- Comment #14 from tasbeak@googlemail.com ---
>  hallelujah, just got KR4.9.2 - the editor is is wrapping properly again.
> 
>