https://bugs.kde.org/show_bug.cgi?id=433455

--- Comment #32 from Dmitri Koulikoff <k...@mitrah.ru> ---
(In reply to Kåre Särs from comment #30)
> What is the use-case for not removing trailing spaces on one line where you
> happen to have your cursor?

  veggero had explainded. For me the every-day's use-case is the following. I
write the specs, and after one or more specs is written I have a new line with
the only spaces to start a new spec with the required indent. Then I save the
file in order to run the spec suit to check that the previous code is written
correct. And at this time all spaces disappear and the cursor moves left to the
start of the line. To continue I have to type the missing spaces again. This is
really very annoying. Believe me.

> I can imagine a situation where you have random trailing spaces in a
> document and you do not want to destroy git history or if you want to edit a
> markdown file, that might need two empty spaces at the end of a line...

  Yes, and this is the second case not so often happened but also a typical, I
have an old file from a git repo and need to add several lines and be sure I
have not left any trailing spaces after adding a hundred of lines except the
one. If the trailing spaces under cursor are preserved I can do that easy
without checking every previously entered line.

> Wouldn't it be a better solution to have a separate save action that never
> strips trailing spaces?

  Yes this option is present. But I never used it as always, if I need to keep
the trailing spaces, it is related only to the few lines.

> The previous behavior was a mistake that was introduced during a time when
> KDevelop crashed a bit too often and saving often in KDevelop was common...

  The previous behaviour was not a mistake. It was very clever done.

  To summarise, I suggest to leave the 3 select options in "Remove trailing
spaces" item:
- never
- always
- only on modified lines

  AND for the latter option the spaces to the left of the cursor must be
preserved. It is quite safe as when one saves the file again later with the
cursor placed somewhere else, the previously kept spaces will be removed. But
if I need them to be kept I will just reload the file after the save and these
spaces will survive the next saves.

  As the alternative to the above you can add a checkbox with "keep the
trailing lines to the left of the cursor" to make the behaviour to be more
declared. And then it should affect the option "always".

  And the last solution to have 4 options with
- only on modified lines
- only on modified lines keeping them to the left of cursor

  I hope I was clear enough explaining why the preservation of the training
spaces to the left of the cursor is urgent required and how to make it work
correctly.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to