Bug 18228 - Automatic indentation mode doesn't remove trailing whitespace
Summary: Automatic indentation mode doesn't remove trailing whitespace
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: Text Editor ()
Version: 4.2.x
Hardware: PC Mac OS
: Normal normal
Target Milestone: master
Assignee: Mike Krüger
Depends on:
Reported: 2014-03-06 15:27 UTC by Adam Kemp
Modified: 2014-03-07 08:11 UTC (History)
2 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Adam Kemp 2014-03-06 15:27:40 UTC
If you set the "Indentation mode" (Text Editor->Behavior) to "Automatic" then the "Remove trailing whitespace" setting (Source Code->Code Formatting->Text file) setting doesn't seem to work.

To reproduce, set indentation mode to automatic and turn on remove trailing whitespace. Now edit a file and hit enter on an indented line. There will be spaces inserted to match the indentation level. Hitting enter again leaves those spaces in the file (they are not removed).

Now change the indentation mode to "Smart" and repeat the experiment. Now when you hit enter the cursor is indented properly, but the spaces are not inserted into the file until you type something on that line. If you don't type something on that line then it doesn't insert any spaces.

This is important to me because the "Smart" indentation mode very often does the wrong thing in my code, and it insists on changing the indentation of lines incorrectly as I edit them. But if I don't use "Smart" then I get extra whitespace all over my file.
Comment 1 Mike Krüger 2014-03-07 01:52:13 UTC
If the indentation in 'smart' does the wrong thing then either

a) Are the formatting settings wrong (there are plenty of formatting options). You need to adjust them to your desired formatting.

b) You're running into a bug
Comment 2 Mike Krüger 2014-03-07 08:11:08 UTC