Bug 64537

Summary: tab character not converted to spaces; word wrapping breaks.
Product: [Applications] kmail Reporter: Amit Shah <amitshah>
Component: composerAssignee: kdepim bugs <kdepim-bugs>
Status: RESOLVED UPSTREAM    
Severity: normal CC: bbennetts, dominik.tritscher, kollix, rusty
Priority: NOR Keywords: testcase, triaged
Version: 1.10.0   
Target Milestone: ---   
Platform: Debian testing   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: Testcase with broken wrapping

Description Amit Shah 2003-09-19 11:33:09 UTC
Version:           1.5.3 (using KDE KDE 3.1.3)
Installed from:    Debian testing/unstable Packages
OS:          Linux

The wordwrapping breaks in the composer window if tabs are included in a line. It is recognized as one character, so the wordwrapping algorithm increments the column count by just one, where infact, it should be incremented by 8 (tab size).
Comment 1 Tom Albers 2004-08-07 14:01:36 UTC
I can confirm this bug still exists in the development version of KMail. Just paste the test 'wrap test ' 30 times so you see where the wrapping supposed to be and then press tab and paste a couple of times extra to see the word wrap for that line. You see this is not working as it should.
Comment 2 Tom Albers 2004-08-07 23:29:01 UTC
*** Bug 79737 has been marked as a duplicate of this bug. ***
Comment 3 Daniel Phillips 2004-11-08 05:20:59 UTC
Kmail composer replaces tabs by single spaces before sending or saving in drafts.

I can confirm that this bug exists in Kmail 1.7 under Gentoo and Debian Sid, and in the 1.7.50 nightly snapshot, which I have built for debugging.  This bug did not exist in Kmail 1.6.2 or earlier.
Comment 4 Daniel Phillips 2004-11-08 05:32:28 UTC
Steps to demonstrate this bug:

  - Compose a new mail

  - Enter text:
      <tab>sometext

  - Save in drafts

  - Open mail in drafts, the text of the mail is:
      <space>sometext

  - Save the mail to a file, this demonstrates that the tab
    has really changed to a space, not just been incorrectly
    displayed
Comment 5 Daniel Phillips 2004-11-08 08:29:55 UTC
I admit it, I'm a c++ klutz, however I think I've gone about as far as I can go
without building kdelibs and qt for debug also, which I don't want to do on my
workstation, maybe I'll try it later on the Gentoo box.

The badness has already happened in MessageComposer::breakLinesAndApplyCodec()
at text = mComposeWin->mEditor->text():

   (gdb) p text.ascii() 
   $23 = 0x8341500 " text"
   # this should have been "\ttext" 

which suggests the problem is deep in KEdit.  If I poke a tab into the string,
and continue, I get a complaint later that "Not all characters fit into the 
chosen encoding."  I chose "send anyway (and lose characters)", and lo, the tab 
made it through to the drafts folder.  The encoding is supposedly set to 
us-ascii.  Last time I checked, us-ascii had a tab.  Maybe this is a clue.
Comment 6 Luke-Jr 2004-12-18 02:59:58 UTC
This bug report is a bug in itself-- I want my tabs to stay tabs, with a visible width of 4.
Comment 7 Edwin Schepers 2004-12-18 18:33:31 UTC
it looks like the original report doesn't speak about the bug that a tab is converted to a space, but about a bug in the wordwrapping.
About the bug about tabs being converted to spaces, I refer to 90688
Comment 8 Thomas McGuire 2007-11-02 17:30:45 UTC
*** Bug 151358 has been marked as a duplicate of this bug. ***
Comment 9 Dominik Tritscher 2008-08-31 23:52:11 UTC
Created attachment 27153 [details]
Testcase with broken wrapping

I created a simple testcase containing several lines with correct wrapping. In the first line i added some tabs to show that the line gets longer as it should.
With that testcase I can confirm that problem using KMail 1.10.0
Comment 10 Martin Koller 2009-08-26 21:06:46 UTC
Still the case with Qt-4.5.2/KDE 4.3
This is a Qt bug. It wraps lines containing Tabs not at the defined FixedColumnWidth.

I reported the bug to Qt-Software