Skip to content

Don't fold single line def - #534

Merged
klen merged 1 commit into
python-mode:developfrom
Ram-Z:singleline-def
Aug 26, 2015
Merged

klen merged 1 commit into
python-mode:developfrom
Ram-Z:singleline-def

Conversation

@Ram-Z

@Ram-Z Ram-Z commented Feb 23, 2015

Copy link
Copy Markdown
Contributor

Simply checks whether the next line is more indented than the line
matching def_regex and if it's not don't increase the fold level.

Avoids an issue where

def rev(x): return reverse(x)
if something:
  def rev(x): return x

gets folded to

def rev(x): return reverse(x)

not showing the rest of the code.

Simply checks whether the next line is more indented than the line
matching def_regex and if it's not don't increase the fold level.
@Ram-Z

Ram-Z commented Feb 23, 2015

Copy link
Copy Markdown
Contributor Author

Come to think of it, this will still fold if the following line is empty, so probably another approach would be better.

klen added a commit that referenced this pull request Aug 26, 2015
@klen
klen merged commit fb2ab53 into python-mode:develop Aug 26, 2015
@klen

klen commented Aug 26, 2015

Copy link
Copy Markdown
Collaborator

Thank you!

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