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

Add auto-indent when pasting - #4192

Merged
maxbrunsfeld merged 7 commits into
masterfrom
mb-auto-indent-on-paste
Nov 17, 2014
Merged

maxbrunsfeld merged 7 commits into
masterfrom
mb-auto-indent-on-paste

Conversation

@maxbrunsfeld

Copy link
Copy Markdown
Contributor

Currently, auto-indent is not used when pasting. This makes sense for coffeescript and other indentation-sensitive languages, because in those languages, auto-indent would often make the indentation worse. This adds a separate config option, autoIndentOnPaste that allows auto-indentation to be used when pasting.

@atom/core Do you guys think there's anything we need to do make it clear that autoIndentOnPaste completely supercedes normalizeIndentOnPaste?

Closes #1407

  • auto-indent pasted text
  • in ::suggestedIndentForBufferRow, base indentation on previous non-blank line
  • don't auto-indent when pasting after non-whitespace characters
  • make a separate config option, editor.autoIndentOnPaste for auto-indenting pasted text
  • add a description to the original autoIndent config option, differentiating it from autoIndentOnPaste

@maxbrunsfeld
maxbrunsfeld force-pushed the mb-auto-indent-on-paste branch from 53a0d45 to 958dc92 Compare November 14, 2014 22:57
@maxbrunsfeld
maxbrunsfeld force-pushed the mb-auto-indent-on-paste branch from 621756e to 83040d1 Compare November 17, 2014 16:54
This way, this option (`autoIndentOnPaste`) can be turned off for
indentation-sensitive languages like coffeescript.
@maxbrunsfeld
maxbrunsfeld force-pushed the mb-auto-indent-on-paste branch from b6c71a3 to 175a8b6 Compare November 17, 2014 18:30
@maxbrunsfeld maxbrunsfeld changed the title Respect the editor.autoIndent option when pasting Add auto-indent when pasting Nov 17, 2014
Comment thread src/config-schema.coffee Outdated

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you guys think of this description?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about something like "Automatically indent the cursor when inserting a newline"?

@maxbrunsfeld

Copy link
Copy Markdown
Contributor Author

Ok, merging since c6c58eb passed CI.

maxbrunsfeld added a commit that referenced this pull request Nov 17, 2014
@maxbrunsfeld
maxbrunsfeld merged commit 4a9d0ab into master Nov 17, 2014
@maxbrunsfeld
maxbrunsfeld deleted the mb-auto-indent-on-paste branch November 17, 2014 23:22
@nathansobo

Copy link
Copy Markdown
Contributor

✨

@nukkamoto

Copy link
Copy Markdown

This seems to cause a problem when I paste, I think ST3 uses ctrl+shift+v, if you want a relative paste, or so called special paste.

I would rather have a paste as it is by default so i know what to expect and do manual indentation if I have to.

The problem at the moment is similar to this ticked #4235, but on coffee-script. (on windows 7)

@maxbrunsfeld

Copy link
Copy Markdown
Contributor Author

@valtido, is it still happening for you on the latest release? We have now disabled auto-indent-on-paste by default for all whitespace sensitive languages: CoffeeScript, YAML, python, and Sass.

@nukkamoto

Copy link
Copy Markdown

If I paste coffeescript with `Auto indent on paste" on, the problem is still there,

If I turn off Auto indent on paste the problem goes away. im on v0.147.0

@thomasjo

Copy link
Copy Markdown
Contributor

@valtido You need to upgrade, the behavior was fixed in v0.148.0 — and current version is 0.150.0.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

5 participants