bpo-35610: IDLE - Replace .context_use_ps1 with .prompt_last_line (GH-11307)

Changes in bpo- 31858 made the less informative 'context_use_ps1' redundant.
This commit is contained in:
Cheryl Sabella 2019-06-02 14:56:47 -04:00 committed by Terry Jan Reedy
parent 5df4025f42
commit 6bdc4dee01
8 changed files with 13 additions and 13 deletions

View file

@ -228,10 +228,6 @@ class EditorWindow(object):
self.indentwidth = self.tabwidth
self.set_notabs_indentwidth()
# If context_use_ps1 is true, parsing searches back for a ps1 line;
# else searches for a popular (if, def, ...) Python stmt.
self.context_use_ps1 = False
# When searching backwards for a reliable place to begin parsing,
# first start num_context_lines[0] lines back, then
# num_context_lines[1] lines back if that didn't work, and so on.
@ -1337,14 +1333,13 @@ class EditorWindow(object):
# open/close first need to find the last stmt
lno = index2line(text.index('insert'))
y = pyparse.Parser(self.indentwidth, self.tabwidth)
if not self.context_use_ps1:
if not self.prompt_last_line:
for context in self.num_context_lines:
startat = max(lno - context, 1)
startatindex = repr(startat) + ".0"
rawtext = text.get(startatindex, "insert")
y.set_code(rawtext)
bod = y.find_good_parse_start(
self.context_use_ps1,
self._build_char_in_string_func(startatindex))
if bod is not None or startat == 1:
break