-
Notifications
You must be signed in to change notification settings - Fork 275
"Normalize Indent on Paste" does not normalize indent on paste. #110
Comments
This is the expected behavior, but I can see how it is confusing. The current implementation normalizes the indent based on the cursor position. Are you looking for a behavior that would auto-indent on paste? |
I misunderstood the feature as normalizing the indentation of the copy-buffer with the code around it, not to paste at the cursor's depth. I unfortunately don't have a way to make a gif of what I mean (as the feature doesn't exist in Atom, Sublime Text, or NetBeans which are the only editors I have). Lets say you have the following text in your buffer (dots for spaces for illustrative purposes): ..function foo(){
....// Do some stuff.
..} And you paste it into a file containing this code (pipe is where the cursor is): (function(){
....function bar(){
........// Do some other stuff.
....}
|
})(); Atom would recognize that the copy-buffer is using 2-space indentation and the file is using 4-space. Then it would "normalize the indentation" of the copy-buffer to match the file and you get: (function(){
....function bar(){
........// Do some other stuff.
....}
....function foo(){
........// Do some stuff.
....}
})(); In my original gif example, this feature would appear to do nothing because the copy-buffer and the paste target have the same indentation. Since the original "bug" is actually a feature, do you want me to create a new ticket requesting this feature? |
I was also expecting Atom to adjust indent on paste. |
👍 |
Same problem here. When I have that option enabled, and I paste, I expect it to maintain the proper indentation for the entire block of code pasted. For now, a workaround is to paste, then select the pasted code and choose On a side note, @NatalieWolfe : how did you make that animated GIF screen cap? |
@CaptSaltyJack http://www.cockos.com/licecap/ Very handy for demonstrating bugs. :) |
Wow, very handy indeed. Pro-tip of the month, easily! Thanks! |
Hmm, hang on. As of 0.141.0, Normalize Indent seems to work as expected. |
The feature still functions exactly as in my original gif for me with Atom 0.141.0 on Mac OS X 10.10. |
I had it misbehave again once. It seems intermittent. |
Is this option still available, because I can't find it in Settings > Settings > Editor Settings ? |
Yep, looks good now ✨ |
@NatalieWolfe commented on 15 jan. 2015 21:04 CET:
I still see this option for some language grammars. For example language-jade and language-sln. Is this an issue for here or an issue for those packages? The option also appears as an text field, instead of the previously used checkbox. |
If the option is in the settings for those language packages, then you should probably report the issue on those packages. |
Is there a way to get it so pasting code where the cursor is already indented rather than at the start of the line works in the same way? I was 2 indents in, pasted 3 lines with no indentation and the next 2 lines started at the start of a line rather than keeping consistent indent level. If I remove the current indent so the cursor is at the start of the line prior to the paste, code is indented consistently at 2 indents in. |
@polarathene +1, always causing frustration |
In fact it does the opposite.
I would have expected the pastes when "Normalize Indent on Paste" is on to be aligned with the other function definitions, but they are instead always inserted at column 1.
The text was updated successfully, but these errors were encountered: