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

Paste indentation issue with auto-indent off #13505

Open
madakk opened this Issue Dec 26, 2016 · 7 comments

Comments

Projects
None yet
5 participants
@madakk
Copy link

madakk commented Dec 26, 2016

Prerequisites

Description

Paste apparently takes the current indentation into account, even when Auto Indent and Auto Indent On Paste are off. This happens in any grammar, including plain text.

Steps to Reproduce

  1. Type the following:
a
  b
    c
  1. Copy from (and including) the new-line at the end of the first line, upto the end of the second line. Go to the end of the third line, and paste.

Expected behavior: The result should be:

a
  b
    c
  b

Actual behavior: The result is:

a
  b
    c
      b

Reproduces how often: 100%

Versions

Atom : 1.12.7
Electron: 1.3.13
Chrome : 52.0.2743.82
Node : 6.5.0

apm 1.12.9
npm 3.10.5
node 4.4.5
python
git
visual studio 2013

Windows 8.1

Additional Information

gif

@AndreaGriffiths11

This comment has been minimized.

Copy link

AndreaGriffiths11 commented Jan 31, 2017

I was able to reproduce on Atom v1.13.0 on Mac OS X 10.12.2.

@ajostergaard

This comment has been minimized.

Copy link

ajostergaard commented Aug 31, 2018

Same on 1.30.0 x64 with plain text and:

"*":
  editor:
    autoIndent: false
    autoIndentOnPaste: false
    normalizeIndentOnPaste: false

Also, similarly:

a
  b
    c
    d

Copy 'd' to after 'b' and you get:

a
  b
  d
    c
    d

When you were expecting:

a
  b
    d
    c
    d

And the obligatory gif:

atom-indent-bug

Super annoying!

@mhulse

This comment has been minimized.

Copy link

mhulse commented Sep 14, 2018

Related forum post (comes with animated examples):

Copy/paste indent wrong: How to fix?

I run into this issue pretty regularly and always find it annoying as the behavior is different from any other editors I've used. In my humble opinion, it's not intuitive.

Anyway, not sure if it will help, but here's some comparisons:

Atom 1.30.0

atom 1 30 0

TextEdit

textedit

Sublime Text 3.1.1

sublime text 3 1 1

BBEdit 12.1.5

bbedit 12 1 5

TextMate 2.0-rc.10

textmate 2 0-rc 10

Visual Studio Code 1.27.2

visual studio code 1 27 2

Config settings:

  editor:
    autoIndent: false
    autoIndentOnPaste: false
    normalizeIndentOnPaste: false

System info:

Atom    : 1.30.0
Electron: 2.0.5
Chrome  : 61.0.3163.100
Node    : 8.9.3
@yanamal

This comment has been minimized.

Copy link

yanamal commented Nov 7, 2018

I am having the same issue on Atom 1.32.1 on Mac OSX

This behavior makes no sense to me, I can't even build a good mental model of what it's doing after scanning the linked forum post.

If I have all the "smart auto clever indent" things off, I want "paste" to paste exactly the characters that I have just copied. How can I accomplish that?

@mhulse

This comment has been minimized.

Copy link

mhulse commented Nov 7, 2018

How can I accomplish that?

I could be wrong, but I don't think you can at this time. :(

Note that this issue is marked as a bug.

Now, we either wait for someone to fix or try to do a PR.

Alternative would be to write a plugin, but at that point, time might be better spent trying to patch Atom’s core code.

I wish I had a better answer.

@yanamal

This comment has been minimized.

Copy link

yanamal commented Nov 8, 2018

Note that this issue is marked as a bug.

Ah, thanks for pointing that out. I got a serious whiff of "Will Not Fix, Working As Intended" from the forum thread (even though the person there technically was not speaking for the dev team)

for reference - I just tried "Command-SHIFT-V" instead of "Command-V" on a whim and it worked (i.e. it just pastes exactly what I had copied). In a way, that's sort of the opposite of what Command-SHIFT-V ("paste without formatting") usually does in rich-text editors, but whatever.

(also, based on the PR that implemented that functionality, the relevant option seems to be options.preserveTrailingLineIndentation; maybe I'll try to figure out how to expose/control that in my copious free time. That or go back to TextMate.)

@mhulse

This comment has been minimized.

Copy link

mhulse commented Nov 8, 2018

for reference - I just tried "Command-SHIFT-V" instead of "Command-V" on a whim and it worked (i.e. it just pastes exactly what I had copied). In a way, that's sort of the opposite of what Command-SHIFT-V ("paste without formatting") usually does in rich-text editors, but whatever.

Oooh, nice find! I had not even considered CMD + SHIFT + V!

I just added this to my keymap.cson:

'atom-workspace':
  'cmd-v': 'editor:paste-without-reformatting'

Not fully tested in numerous situation, but appears to fix the copy/paste issue.

Interesting ... Good find @yanamal!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment