Skip to content

Commit

Permalink
Merge Py Idle changes:
Browse files Browse the repository at this point in the history
Rev 1.5  doerwalter
string methods
  • Loading branch information
kbkaiser committed Sep 16, 2002
1 parent 01166da commit 6b06f29
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions Lib/idlelib/IdleHistory.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import string

class History:

def __init__(self, text, output_sep = "\n"):
Expand All @@ -22,11 +20,11 @@ def history_prev(self, event):
def _get_source(self, start, end):
# Get source code from start index to end index. Lines in the
# text control may be separated by sys.ps2 .
lines = string.split(self.text.get(start, end), self.output_sep)
return string.join(lines, "\n")
lines = self.text.get(start, end).split(self.output_sep)
return "\n".join(lines)

def _put_source(self, where, source):
output = string.join(string.split(source, "\n"), self.output_sep)
output = self.output_sep.join(source.split("\n"))
self.text.insert(where, output)

def history_do(self, reverse):
Expand Down Expand Up @@ -68,7 +66,7 @@ def history_do(self, reverse):
self.history_prefix = prefix

def history_store(self, source):
source = string.strip(source)
source = source.strip()
if len(source) > 2:
# avoid duplicates
try:
Expand All @@ -80,7 +78,7 @@ def history_store(self, source):
self.history_prefix = None

def recall(self, s):
s = string.strip(s)
s = s.strip()
self.text.tag_remove("sel", "1.0", "end")
self.text.delete("iomark", "end-1c")
self.text.mark_set("insert", "end-1c")
Expand Down

0 comments on commit 6b06f29

Please sign in to comment.