Bug 55484 - Wordwrap doesn't respect white space
Summary: Wordwrap doesn't respect white space
Status: RESOLVED FIXED
Alias: None
Product: kate
Classification: Applications
Component: part (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-03-03 21:26 UTC by alan
Modified: 2003-10-11 11:45 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
patch to fix bug (2.27 KB, patch)
2003-03-06 21:48 UTC, alan
Details

Note You need to log in before you can comment on or make changes to this bug.
Description alan 2003-03-03 21:26:54 UTC
Version:            (using KDE Devel)
Installed from:    Compiled sources
Compiler:          gcc 3.2.3 
OS:          Linux

If you type characters midway along line 1 then the words that are displaced into line 2.  If there is already text on line 2 then you would expect the wrap to cause a space between the word wrapped and the previous text.

This does not happen to the first word wrapped around, although it does happen to the second and up.

If you move the cursor away from line 1 and then back again and repeat then the white space is lost again on the next wrap - but remains for subsequent words.

Its as though (and a brief look at the code makes me suspect that this is the case) that when the cursor is moved from a line, trailing spaces are removed, thus explaining why the first to wrap does not have the same space as the rest.
Comment 1 Hamish Rodda 2003-03-05 13:14:57 UTC
Yes, whitespace is removed from the end of lines if you have the "remove trailing 
spaces" option.  You might be able to get your intended behaviour by de-selecting 
this option.  Unfortunately I don't know how the fixed-wrapping code works so I can't 
help here. 
Comment 2 alan 2003-03-06 21:48:43 UTC
Created attachment 1118 [details]
patch to fix bug

This is the first patch I have ever made - so I hope I have done it right.

Its for kdelibs/kate/part/katedocument.cpp

I had some problem deciding when to add white space in and when not.  There
doesn't seem to be a definitive answer.  In the end I decided it should only be
done when the line is capable of being broken into words and not otherwise.
Comment 3 Christoph Cullmann 2003-03-06 23:26:14 UTC
could you try to test it with my last changes in CVS HEAD (in kdelibs/kate/part)
without your patch ? I have changed the "remove trailing spaces" option to only
remove the spaces on save (and only in the file, won't change the content of
your document until you close and reopen it).
Comment 4 alan 2003-03-07 00:10:37 UTC
Subject: Re:  Wordwrap doesn't respect white space

On Thursday 06 Mar 2003 10:26 pm, you wrote:
> ------- You are receiving this mail because: -------
> You reported the bug, or are watching the reporter.
>
> http://bugs.kde.org/show_bug.cgi?id=55484
>
>
>
>
> ------- Additional Comments From crossfire@babylon2k.de  2003-03-06 23:26
> ------- could you try to test it with my last changes in CVS HEAD (in
> kdelibs/kate/part) without your patch ? I have changed the "remove trailing
> spaces" option to only remove the spaces on save (and only in the file,
> won't change the content of your document until you close and reopen it).

It works except of course if you save the file and then open it again.  At 
that point, when you enter some text in the middle of a line and it wraps the 
white space is then lost.  My patch gets over that problem.

Comment 5 alan 2003-03-15 12:36:30 UTC
Just wanted to ask if anything is going to happen to this patch.  I don't have access to 
cvs so if it is going to be put in then it has to be by someone else. 
 
I know the other approach (of leaving spaces on the end of lines until save) helps, but 
as my last message points out this doesn't solve the whole problem 
Comment 6 Samir M. Nassar 2003-05-07 20:53:36 UTC
Subject: Re: Reminder to check on patch status

This bug is still present in 3.1.1a as well as KDE 3.2 CVS (As of May 01)

Just a reminder. Since this bug really should _not_ be in an editor.

Comment 7 Christoph Cullmann 2003-05-16 22:38:09 UTC
sorry, sorry ;) missed to apply the patch, fixed in CVS HEAD 
will be fixed for 3.2, together with many other bugs, sorry for delay, if somebody with a 
working 3_1 branch in kwrite-devel reads this, please backport 
Comment 8 Alexander Patrakov 2003-07-31 19:11:22 UTC
Please reopen: the fix is improper since it creates another bug when the 
setting is not to strip whitespace. To reproduce: type several lines of words, 
don't press Enter, rely on wordwrap. A single extra space will be appended to 
the text you typed. 
Comment 9 Alexander Patrakov 2003-07-31 19:12:30 UTC
The bug is still alive in KDE 3.1.3 
Comment 10 Christoph Cullmann 2003-07-31 19:23:25 UTC
right :/ 
Comment 11 Christoph Cullmann 2003-07-31 21:19:32 UTC
perhaps fix in cvs head now, could you test it ? not sure if it does the intended stuff 
Comment 12 Christoph Cullmann 2003-07-31 22:07:35 UTC
btw., if my fix works, if somebody has time to backport it, here are the commits: 
 
 M +6 -15     katedocument.cpp   1.558 
 M +12 -5     katedocument.cpp   1.559 
Comment 13 Christoph Cullmann 2003-08-06 02:02:40 UTC
works here ;) 
Comment 14 Alexander Patrakov 2003-10-11 11:45:18 UTC
The bug is still alive in KDE 3.1.4