Skip to content
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

PR: Fix pasting code in the Editor #16164

Merged
merged 5 commits into from
Aug 13, 2021
Merged

Conversation

impact27
Copy link
Contributor

@impact27 impact27 commented Aug 6, 2021

Description of Changes

The paste logic does two things:

  1. When pasting multiline text, it keeps the following lines at the same indentation as the first line. Exception: The following lines maximum de-dent is the smallest indentation in the clipboard.
  2. For python code, it tries to avoid creating over-indented lines (created because of auto-indentation). To achieve this, it will de-dent until reaching a valid indentation. The resulting indentation can not be smaller than either:
    • The current cursor position
    • The copied indentation
  • Wrote at least one-line docstrings (for any new functions)
  • Added unit test(s) covering the changes (if testable)
  • Included a screenshot or animation (if affecting the UI, see Licecap)

Issue(s) Resolved

Fixes #16159

Affirmation

By submitting this Pull Request or typing my (user)name below,
I affirm the Developer Certificate of Origin
with respect to all commits and content included in this PR,
and understand I am releasing the same under Spyder's MIT (Expat) license.

I certify the above statement is true and correct:

@pep8speaks
Copy link

pep8speaks commented Aug 6, 2021

Hello @impact27! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

Line 2840:1: W293 blank line contains whitespace

Line 174:80: E501 line too long (89 > 79 characters)
Line 175:80: E501 line too long (93 > 79 characters)
Line 176:80: E501 line too long (105 > 79 characters)
Line 200:80: E501 line too long (93 > 79 characters)
Line 201:80: E501 line too long (93 > 79 characters)
Line 202:80: E501 line too long (105 > 79 characters)

Comment last updated at 2021-08-12 16:29:54 UTC

@ccordoba12 ccordoba12 changed the base branch from master to 5.x August 10, 2021 00:05
@ccordoba12 ccordoba12 changed the title PR: Fix paste PR: Fix pasting code in the Editor Aug 12, 2021
Copy link
Member

@ccordoba12 ccordoba12 left a comment

Choose a reason for hiding this comment

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

@impact27, thanks a lot for your help with this! It looks good to me, so please merge with 5.x to get the fix to our tests, then this should be ready.

@ccordoba12 ccordoba12 added this to the v5.1.2 milestone Aug 12, 2021
@impact27
Copy link
Contributor Author

Restarting the tests

@impact27 impact27 closed this Aug 13, 2021
@impact27 impact27 reopened this Aug 13, 2021
Copy link
Member

@ccordoba12 ccordoba12 left a comment

Choose a reason for hiding this comment

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

Thanks @impact27!

@ccordoba12 ccordoba12 merged commit c9c4fb5 into spyder-ide:5.x Aug 13, 2021
ccordoba12 added a commit that referenced this pull request Aug 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5.1.1 : omitted indentation when pasting with the editor
3 participants