-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Save removes whitespace at the start of a line #22179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Sorry, may that 2 spaces, not 4. |
This comment was originally written by [email protected] If nothing follows that whitespace, that whitespace is at the end of the line. Trailing whitespace is removed on-save if you've enabled this feature (Tools->Preferences->Editor->Save actions->Remove trailing whitespace). |
In which case the heuristic may need adjusting so that it doesn't strip whitespace off lines that are in the middle of the file that contain only whitespace. |
This comment was originally written by [email protected] Stripping any trailing whitespace (even if there isn't anything other than whitespace) is the desired behavior. Other editors and IDEs do the same. The only difference is that some editors (e.g. Netbeans 8.0.2) do not remove the whitespace in front of the cursor. Having this special case for the current line prevents that cursor-jump you were seeing. I attached an image which illustrates the effect. I'm using a theme which uses a pink strike-through line to highlight trailing whitespace. Attachment: |
Thanks - yes, I agree, that would also solve the most serious problem. I'm still not terribly convinced that having whitespace stripping so that the indent doesn't match the natural indent is the right behaviour, but that is less important than the cursor jumping behaviour. |
Set owner to @scheglov. |
https://codereview.chromium.org/920073003 As https://code.google.com/p/dart/issues/detail?id=22179#c4 advised. Added Started label. |
Added this to the 1.9 milestone. |
Repro:
main(List<String> args) {
<----
}
Enter at <---- correctly indents 4 chars.
Press Cmd + S, the cursor jumps back to the start of the line.
The text was updated successfully, but these errors were encountered: