Skip to content

Commit 562ad3f

Browse files
committed
Simplify insert_char_pair_start
1 parent 30f8dba commit 562ad3f

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

bpython/curtsiesfrontend/repl.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -834,7 +834,6 @@ def insert_char_pair_start(self, e):
834834
"""
835835
self.add_normal_character(e)
836836
if self.config.brackets_completion:
837-
allowed_chars = ["}", ")", "]", " "]
838837
start_of_line = len(self._current_line) == 1
839838
end_of_line = len(self._current_line) == self._cursor_offset
840839
can_lookup_next = len(self._current_line) > self._cursor_offset
@@ -843,10 +842,8 @@ def insert_char_pair_start(self, e):
843842
if not can_lookup_next
844843
else self._current_line[self._cursor_offset]
845844
)
846-
next_char_allowed = next_char in allowed_chars
847-
if start_of_line or end_of_line or next_char_allowed:
848-
closing_char = CHARACTER_PAIR_MAP[e]
849-
self.add_normal_character(closing_char, narrow_search=False)
845+
if start_of_line or end_of_line or next_char in "})] ":
846+
self.add_normal_character(CHARACTER_PAIR_MAP[e], narrow_search=False)
850847
self._cursor_offset -= 1
851848

852849
def insert_char_pair_end(self, e):

0 commit comments

Comments
 (0)