| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 4c31791 commit dbec792
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -249,7 +249,7 @@ def _should_auto_indent(buffer: list[str], pos: int) -> bool: | |||
| 249 | 249 | while pos > 0: | |
| 250 | 250 | pos -= 1 | |
| 251 | 251 | if last_char is None: | |
| 252 | - if buffer[pos] not in " \t\n": # ignore whitespaces | ||
| 252 | + if buffer[pos] not in " \t\n#": # ignore whitespaces and comments | ||
| 253 | 253 | last_char = buffer[pos] | |
| 254 | 254 | else: | |
| 255 | 255 | # even if we found a non-whitespace character before | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -465,6 +465,24 @@ def test_auto_indent_with_comment(self): | |||
| 465 | 465 | output = multiline_input(reader) | |
| 466 | 466 | self.assertEqual(output, output_code) | |
| 467 | 467 | ||
| 468 | + def test_auto_indent_with_multicomment(self): | ||
| 469 | + # fmt: off | ||
| 470 | + events = code_to_events( | ||
| 471 | + "def f(): ## foo\n" | ||
| 472 | + "pass\n\n" | ||
| 473 | + ) | ||
| 474 | + | ||
| 475 | + output_code = ( | ||
| 476 | + "def f(): ## foo\n" | ||
| 477 | + " pass\n" | ||
| 478 | + " " | ||
| 479 | + ) | ||
| 480 | + # fmt: on | ||
| 481 | + | ||
| 482 | + reader = self.prepare_reader(events) | ||
| 483 | + output = multiline_input(reader) | ||
| 484 | + self.assertEqual(output, output_code) | ||
| 485 | + | ||
| 468 | 486 | def test_auto_indent_ignore_comments(self): | |
| 469 | 487 | # fmt: off | |
| 470 | 488 | events = code_to_events( | |
| Back | FazBrowse Home | New Git URL |
0 commit comments