diff -u ORIG/EditorWindow.py ./EditorWindow.py --- ORIG/EditorWindow.py 2005-05-11 23:47:29.358329002 -0400 +++ ./EditorWindow.py 2005-05-12 00:33:56.385420821 -0400 @@ -1119,6 +1119,7 @@ if bod is not None or startat == 1: break y.set_lo(bod or 0) + c = y.get_continuation_type() if c != PyParse.C_NONE: # The current stmt hasn't ended yet. @@ -1149,6 +1150,8 @@ # indentation of initial line of closest preceding # interesting stmt. indent = y.get_base_indent_string() + if self.context_use_ps1 and y.is_first_line_continuation(): + indent = ' '*len(sys.ps1.split('\n')[-1]) + indent text.insert("insert", indent) if y.is_block_opener(): self.smart_indent_event(event) diff -u ORIG/PyParse.py ./PyParse.py --- ORIG/PyParse.py 2002-09-16 23:55:13.000000000 -0400 +++ ./PyParse.py 2005-05-12 00:28:47.455126030 -0400 @@ -360,6 +360,8 @@ # comment # self.lastopenbracketpos # if continuation is C_BRACKET, index of last open bracket + # self.isfirstlinecont + # if this is a continuation of the first line entered def _study2(self): if self.study_level >= 2: @@ -369,6 +371,7 @@ # Set p and q to slice indices of last interesting stmt. str, goodlines = self.str, self.goodlines + self.isfirstlinecont = str.count('\n') == 1 i = len(goodlines) - 1 p = len(str) # index of newest line while i: @@ -576,6 +579,13 @@ self._study2() return _closere(self.str, self.stmt_start) is not None + # Is this a continuation of the first line after a prompt? + + def is_first_line_continuation(self): + self._study2() + return self.isfirstlinecont + return len(self.goodlines) == 2 + # index of last open bracket ({[, or None if none lastopenbracketpos = None diff -u ORIG/PyShell.py ./PyShell.py --- ORIG/PyShell.py 2005-05-11 23:47:29.360328618 -0400 +++ ./PyShell.py 2005-05-12 00:36:05.858407444 -0400 @@ -796,9 +796,6 @@ __builtin__.quit = __builtin__.exit = "To exit, type Ctrl-D." # ## self.config(usetabs=1, indentwidth=8, context_use_ps1=1) - self.usetabs = True - # indentwidth must be 8 when using tabs. See note in EditorWindow: - self.indentwidth = 8 self.context_use_ps1 = True # text = self.text @@ -1187,6 +1184,8 @@ source = self.text.get("iomark", "end-1c") if self.history: self.history.history_store(source) + if self.text.get("end-1c linestart", "end").strip() == "": + self.text.delete("end-1c linestart", "end") if self.text.get("end-2c") != "\n": self.text.insert("end-1c", "\n") self.text.mark_set("iomark", "end-1c")