Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Lib/idlelib/editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1456,10 +1456,10 @@ def newline_and_indent_event(self, event):
c = y.get_continuation_type()
if c != pyparse.C_NONE:
# The current statement hasn't ended yet.
if c == pyparse.C_STRING_FIRST_LINE:
# After the first line of a string do not indent at all.
pass
elif c == pyparse.C_STRING_NEXT_LINES:
if (
c == pyparse.C_STRING_FIRST_LINE
or c == pyparse.C_STRING_NEXT_LINES
):
# Inside a string which started before this line;
# just mimic the current indent.
text.insert("insert", indent, self.user_input_insert_tags)
Expand Down
4 changes: 2 additions & 2 deletions Lib/idlelib/idle_test/test_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,9 @@ def test_indent_and_newline_event(self):
' def f1(self, a, b):',
' def f1(self,\n a, b):\n',
'1.15'),
TestInfo('Inside string with one line - no indent.',
TestInfo('Inside string with one line.',
' """Docstring."""',
' """Docstring.\n"""\n',
' """Docstring.\n """\n',
'1.15'),
TestInfo('Inside string with more than one line.',
' """Docstring.\n Docstring Line 2"""',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix wrong indent for docstrings
Loading