Commit 6b06f29d authored by Kurt B. Kaiser's avatar Kurt B. Kaiser

Merge Py Idle changes:

Rev 1.5  doerwalter
string methods
parent 01166da8
import string
class History: class History:
def __init__(self, text, output_sep = "\n"): def __init__(self, text, output_sep = "\n"):
...@@ -22,11 +20,11 @@ class History: ...@@ -22,11 +20,11 @@ class History:
def _get_source(self, start, end): def _get_source(self, start, end):
# Get source code from start index to end index. Lines in the # Get source code from start index to end index. Lines in the
# text control may be separated by sys.ps2 . # text control may be separated by sys.ps2 .
lines = string.split(self.text.get(start, end), self.output_sep) lines = self.text.get(start, end).split(self.output_sep)
return string.join(lines, "\n") return "\n".join(lines)
def _put_source(self, where, source): 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) self.text.insert(where, output)
def history_do(self, reverse): def history_do(self, reverse):
...@@ -68,7 +66,7 @@ class History: ...@@ -68,7 +66,7 @@ class History:
self.history_prefix = prefix self.history_prefix = prefix
def history_store(self, source): def history_store(self, source):
source = string.strip(source) source = source.strip()
if len(source) > 2: if len(source) > 2:
# avoid duplicates # avoid duplicates
try: try:
...@@ -80,7 +78,7 @@ class History: ...@@ -80,7 +78,7 @@ class History:
self.history_prefix = None self.history_prefix = None
def recall(self, s): def recall(self, s):
s = string.strip(s) s = s.strip()
self.text.tag_remove("sel", "1.0", "end") self.text.tag_remove("sel", "1.0", "end")
self.text.delete("iomark", "end-1c") self.text.delete("iomark", "end-1c")
self.text.mark_set("insert", "end-1c") self.text.mark_set("insert", "end-1c")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment