Fix electric indent bug in python-mode after dedenting colon

* list/progmodes/python.el (python-indent-post-self-insert-function):
Use markers instead of positions when reindenting statement(s) after
inserting electric colon to avoid reindenting too many
statements (bug#22663).

* test/lisp/progmodes/python-tests.el (python-indent-electric-colon-2):
Improve test case to also verify the fix of bug#22663.

Copyright-paperwork-exempt: yes
This commit is contained in:
Joel Rosdahl
2018-12-27 16:52:07 +01:00
committed by Eli Zaretskii
parent f6eacc468b
commit a3c79d44cc
2 changed files with 13 additions and 9 deletions

View File

@@ -1161,10 +1161,13 @@ def b()
if do:
something()
else
outside
"
(python-tests-look-at "else")
(goto-char (line-end-position))
(python-tests-self-insert ":")
(should (= (current-indentation) 0))
(python-tests-look-at "outside")
(should (= (current-indentation) 0))))
(ert-deftest python-indent-electric-colon-3 ()