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: Some indentation fixes #4486

Merged
merged 2 commits into from
May 19, 2017
Merged

Conversation

rlaverde
Copy link
Member

@rlaverde rlaverde commented May 17, 2017

Fixes #4475

  • indentation chopping text when indent with tabs
  • inline comments breaking indentation

no xfail tests in auto_indentation 😄🙈

@rlaverde rlaverde added this to the v3.2 milestone May 17, 2017
@rlaverde rlaverde self-assigned this May 17, 2017
@rlaverde rlaverde requested a review from ccordoba12 May 17, 2017 19:17
@@ -1925,6 +1925,11 @@ def fix_indent(self, forward=True, comment_or_string=False):
cursor.movePosition(QTextCursor.PreviousBlock)
prevtext = to_text_string(cursor.block().text()).rstrip()

# Remove inline comment
inline_comment = prevtext.find('#')
Copy link
Member

Choose a reason for hiding this comment

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

Is this enough to detect an inline comment? What if you have a line like

# foo

?

Copy link
Member Author

Choose a reason for hiding this comment

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

prevtext = "" and the indentation will be calculated to 0 as expected.

I was testing and It fails in expressions with # that isn't a comment, and the crop cause to drop a bracket, although it is pretty rare (e. g. a list assignment to a dict element that contains a "#"):

a_dict["#"] = (

a_dict["#"] = (
       |

@ccordoba12
Copy link
Member

@rlaverde, this fixes all issues mentioned in #4475?

@rlaverde
Copy link
Member Author

rlaverde commented May 19, 2017

@rlaverde, this fixes all issues mentioned in #4475?

yes, they are related with auto indentation chopping text when indenting with tabs.

@ccordoba12
Copy link
Member

Ok, let's merge it then.

@ccordoba12 ccordoba12 changed the title PR: Some Indentation fixes PR: Some indentation fixes May 19, 2017
@ccordoba12 ccordoba12 merged commit e301897 into spyder-ide:3.x May 19, 2017
ccordoba12 added a commit that referenced this pull request May 19, 2017
@rlaverde rlaverde deleted the indentation-fixes branch May 19, 2017 23:04
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.

2 participants