bpo-35610: IDLE - Replace .context_use_ps1 with .prompt_last_line (GH… · python/cpython@6bdc4de

Original file line numberDiff line numberDiff line change

@@ -228,10 +228,6 @@ def __init__(self, flist=None, filename=None, key=None, root=None):

228228

self.indentwidth = self.tabwidth

229229

self.set_notabs_indentwidth()

230230
231-

# If context_use_ps1 is true, parsing searches back for a ps1 line;

232-

# else searches for a popular (if, def, ...) Python stmt.

233-

self.context_use_ps1 = False

234-
235231

# When searching backwards for a reliable place to begin parsing,

236232

# first start num_context_lines[0] lines back, then

237233

# num_context_lines[1] lines back if that didn't work, and so on.

@@ -1337,14 +1333,13 @@ def newline_and_indent_event(self, event):

13371333

# open/close first need to find the last stmt

13381334

lno = index2line(text.index('insert'))

13391335

y = pyparse.Parser(self.indentwidth, self.tabwidth)

1340-

if not self.context_use_ps1:

1336+

if not self.prompt_last_line:

13411337

for context in self.num_context_lines:

13421338

startat = max(lno - context, 1)

13431339

startatindex = repr(startat) + ".0"

13441340

rawtext = text.get(startatindex, "insert")

13451341

y.set_code(rawtext)

13461342

bod = y.find_good_parse_start(

1347-

self.context_use_ps1,

13481343

self._build_char_in_string_func(startatindex))

13491344

if bod is not None or startat == 1:

13501345

break