From f484f94a1f1fd36d95fe09f5d2d7849754de7520 Mon Sep 17 00:00:00 2001 From: Eric Burgess Date: Fri, 13 Jan 2023 13:06:13 -0600 Subject: [PATCH] Add more keywords to trigger auto-deindent --- bpython/curtsiesfrontend/repl.py | 4 +++- bpython/repl.py | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/bpython/curtsiesfrontend/repl.py b/bpython/curtsiesfrontend/repl.py index cf7d9c37..037cf756 100644 --- a/bpython/curtsiesfrontend/repl.py +++ b/bpython/curtsiesfrontend/repl.py @@ -1252,7 +1252,9 @@ def predicted_indent(self, line): elif ( line and ":" not in line - and line.strip().startswith(("return", "pass", "raise", "yield")) + and line.strip().startswith( + ("return", "pass", "...", "raise", "yield", "break", "continue") + ) ): indent = max(0, indent - self.config.tab_length) logger.debug("indent we found was %s", indent) diff --git a/bpython/repl.py b/bpython/repl.py index 8aea4e17..c964f090 100644 --- a/bpython/repl.py +++ b/bpython/repl.py @@ -1255,7 +1255,9 @@ def next_indentation(line, tab_length) -> int: if line.rstrip().endswith(":"): indentation += 1 elif indentation >= 1: - if line.lstrip().startswith(("return", "pass", "raise", "yield")): + if line.lstrip().startswith( + ("return", "pass", "...", "raise", "yield", "break", "continue") + ): indentation -= 1 return indentation