Bug 239077 - kate should parse modelines before removing trailing space on load
Summary: kate should parse modelines before removing trailing space on load
Status: RESOLVED FIXED
Alias: None
Product: kate
Classification: Applications
Component: part (show other bugs)
Version: SVN
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-28 01:27 UTC by Matthew Woehlke
Modified: 2012-10-25 14:59 UTC (History)
0 users

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 Matthew Woehlke 2010-05-28 01:27:54 UTC
Version:           SVN (using Devel) 
OS:                Linux

Certain individuals I have to work with have trouble a: accepting that trailing spaces are bad, and b: coping with their removal in any manner. Because I consider it unacceptable to make my editor "broken" to appease such people, I want to use .kateconfig to disable the cleanup in certain directories. However this doesn't work. It seems that kate strips trailing spaces on load (since I never see them after opening a file). While this is okay and desirable if they should be stripped, ISTM kate needs to defer remove-trailing-space-load until after modelines (both in the file and .kateconfig) have been processed, rather than relying solely on the global setting for cleanup-on-load.

Reproducible: Always

Steps to Reproduce:
- Create a file with trailing spaces
- Create a .kateconfig in its directory
- Make sure global 'remove trailing space on load/save' option is enabled
- Open the file

Actual Results:  
No trailing spaces

Expected Results:  
kate reads .kateconfig and leaves trailing spaces alone
Comment 1 Matthew Woehlke 2010-06-24 22:46:20 UTC
proposed patch here: http://reviewboard.kde.org/r/4456/
Comment 2 Matthew Woehlke 2010-08-03 22:34:02 UTC
SVN commit 1158818 by mwoehlke:

delay trailing-space-removal until config/variables are parsed

Move removal of trailing spaces from KateTextBuffer::load to
KateDocument::openFile, after config and variable parsing (which might tell
us not to remove trailing space!) has been performed. Note that the removal
also now goes into the undo stack; for now we're considering this a good
thing.

BUG: 239077


 M  +0 -10     buffer/katetextbuffer.cpp  
 M  +2 -0      document/katebuffer.cpp  
 M  +10 -0     document/katedocument.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1158818
Comment 3 Dominik Haumann 2012-10-24 22:19:48 UTC
This change introduced report #306926. Matthew, can you please comment on this?
Comment 4 Matthew Woehlke 2012-10-24 23:52:57 UTC
Are you sure? Based on my previous comment (and seems to match my recollection), it was always the case that trailing spaces are stripped immediately. Probably because it looks better?

If you're asking an opinion on behavior and not for me to remember a two-year-old code change :-), I would say it is probably okay to not strip on load at all. I guess this means you also have to modify the file before you can save it to affect trailing space stripping; again, okay. (The trick, and I think this might have something to do with the current behavior, is trailing space should be visible on open, then stripped in the internal buffer also on save. ISTR that being problematic at some point, i.e. the file on disk was stripped but kate was still showing trailing spaces. I could be imagining that, though.)
Comment 5 Dominik Haumann 2012-10-25 14:59:34 UTC
Git commit 01253aadd7337694644bd43dea5aab2ab02dd0f4 by Dominik Haumann.
Committed on 25/10/2012 at 16:59.
Pushed by dhaumann into branch 'master'.

never remove trailing spaces on load

This was discussed over the years again and again, and we get bug reports
that criticize that files are modified directly after opening. From now on,
Kate only supports the removal of trailing spaces on save, and not on load.
Related: bug 306926

M  +2    -2    part/dialogs/opensaveconfigwidget.ui
M  +2    -4    part/document/katebuffer.cpp
M  +0    -10   part/document/katedocument.cpp

http://commits.kde.org/kate/01253aadd7337694644bd43dea5aab2ab02dd0f4