Skip to content
This repository was archived by the owner on Mar 3, 2023. It is now read-only.
This repository was archived by the owner on Mar 3, 2023. It is now read-only.

If I've selected a block of ruby that is indented and then paste it on a line that is blank (no with #1407

Closed

Description

@eric

If I've selected a block of ruby that is indented and then paste it on a line that is blank (no with no spaces on it), the lines are inserted with no indentation in front of them, instead of the indendation of the line above.

I have to hit "tab" before pasting if I want to get it to line up with everything else.

Atom Version: 0.44.0
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_1) AppleWebKit/537.36 (KHTML, like Gecko) Atom/0.44.0 Atom-Shell/0.7.6 Safari/537.36

Activity

  1. probablycorey commented on Jan 14, 2014

    @probablycorey

    There is a config option that will fix this for you called editor.normalizeIndentOnPaste

    You can set it in ~/.atom/config.cson

    'editor':
      'normalizeIndentOnPaste': false

    Or using the horribly ugly settings pane
    settings - users_corey atom

  2. nathansobo commented on Jan 14, 2014

    @nathansobo
    Contributor

    I wonder if we should offer a non-normalized variant of paste, like alt-cmd-v.

  3. eric commented on Jan 16, 2014

    @eric
    Author

    I actually want it on, I just want the behavior to be "use the indent of the last non-blank line" instead of "use the indent of the line I'm on", so it works when you've put your cursor after a line of something real.

  4. nathansobo commented on Jan 16, 2014

    @nathansobo
    Contributor

    We may need a second option to infer indent on paste, because while that behavior works great in Ruby and was Atom's original approach, it causes problems in indentation-sensitive languages like CoffeeScript by choosing the level of the end of the method above when pasting a new method. With explicit end delimiters that issue doesn't come up.

  5. eric commented on Jan 16, 2014

    @eric
    Author

    I definitely think that the behavior may need to be specific to the current language set for the file.

  6. nathansobo commented on Jan 16, 2014

    @nathansobo
    Contributor

    @probablycorey Are you okay reopening this issue or opening another one to address it? The current behavior is good for indentation-sensitive languages but not ideal for our Ruby customers. May be worth figuring out some kind of compromise.

  7. probablycorey commented on Jan 16, 2014

    @probablycorey

    Let's reopen it. @eric it sounds like you want "auto indent pasted text". Which is separate from our current auto indent and normalize indent on paste options.

  8. eric commented on Jan 16, 2014

    @eric
    Author

    I guess I'm not sure what I want.

    I know that for me it was jarring to be inserting text on the line below some indented ruby and have it show up as column 0 instead of lined up under the stuff underneath.

    I just played around with textmate and created this:

    class Something
      def anything
        call
    
    
      end
    end

    If I am at column 0 on line 5 and start typing, it automatically moves the cursor to line up with call, but it doesn't in atom.

    I wonder if these behaviors are related to where I expect pastes to go.

    I apologize if this has gone off track, but I'm having trouble articulating what it is that I'm expected, I just know that what is happening now isn't what I'm used to, and is requiring more steps to fix it.

  9. nathansobo commented on Jan 16, 2014

    @nathansobo
    Contributor

    No apologies needed! We appreciate your input. I agree that it's a separate option for auto-indenting. I think in addition it would be a good idea to disable auto-indent for indent-sensitive languages regardless of the option, so people that are working on mixed Ruby/Coffee codebases don't have to toggle it back and forth. Either that, or allow a language to customize it's auto-indent procedure somehow.

  10. eric commented on Feb 13, 2014

    @eric
    Author

    This definitely continues to be the biggest source of frustration I have every day that I use Atom.

    When it comes to working in Ruby, moving code around never ends up where I wanted it the first time without having to re-indent it. This is something I never had to think about with TextMate 2.

  11. bobrocke commented on Jun 9, 2014

    @bobrocke

    I think this is an important feature. It's one of the things that keeps pulling me back to Sublime Text; its smart indent on paste works well.

  12. jescalan commented on Aug 4, 2014

    @jescalan

    +1 for this feature, doing me in consistently

  13. 4 remaining items

  14. self-assigned this
    on Nov 14, 2014
  15. jackson-sandland commented on Sep 11, 2017

    @jackson-sandland

    Has this been resolved? cmd-shift-v should maintain the formatting of where the text is copied from!

  16. nikibrown commented on Sep 24, 2017

    @nikibrown

    Found this after googling how to enable this feature in Atom. Recently switched from sublime. I guess its not there? :(

  17. huntertj commented on Sep 25, 2017

    @huntertj

    I believe I have a similar problem, when I copy and paste from a block of text which includes blank lines, the blank lines are not there when I paste either with ctl+v or ctl+shift+v

  18. removed their assignment
    on Sep 25, 2017
  19. jackson-sandland commented on Oct 22, 2017

    @jackson-sandland

    Guys, this is a such a crucial feature. Is there a solution?

  20. nathansobo commented on Oct 23, 2017

    @nathansobo
    Contributor

    We're working on a new syntax system that should make it much easier to make the kind of syntax-based decisions that good auto-indentation support would require. Ruby will be one of the first supported languages.

  21. huntertj commented on Oct 23, 2017

    @huntertj

    @nathansobo its not specifically a syntax problem. I frequently paste in blocks of text (from code or perhaps a interface file) and line numbers from the source are important. I don't want anything reformatted or missing from the source and blank lines are removed, will this be supported?

  22. nathansobo commented on Oct 23, 2017

    @nathansobo
    Contributor

    @huntertj Ah, I misunderstood since the main issue seems to be about deficiencies in Atom's auto-formatting on paste. You just want a way to paste without any changes to the existing formatting, right?

  23. nathansobo commented on Oct 23, 2017

    @nathansobo
    Contributor

    Okay, I've opened #15976 to add a command to paste without formatting regardless of settings or the source of the copied text. Hopefully that will help.

  24. lock commented on Apr 22, 2018

    @lock

    This issue has been automatically locked since there has not been any recent activity after it was closed. If you can still reproduce this issue in Safe Mode then please open a new issue and fill out the entire issue template to ensure that we have enough information to address your issue. Thanks!

  25. locked and limited conversation to collaborators on Apr 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions