-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Conversation
@@ -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('#') |
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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["#"] = (
|
Ok, let's merge it then. |
Fixes #4475
no xfail tests in auto_indentation 😄🙈