Merge Py Idle changes:

Rev 1.6 doerwalter
(string methods)
This commit is contained in:
Kurt B. Kaiser 2002-09-17 03:43:38 +00:00
parent 7827e1707c
commit d8e20a0e6b
1 changed files with 2 additions and 4 deletions

View File

@ -10,8 +10,6 @@ We'll have to fix IDLE to do something reasonable when two or more
extensions what to capture the same event. extensions what to capture the same event.
""" """
import string
import PyParse import PyParse
from AutoIndent import AutoIndent, index2line from AutoIndent import AutoIndent, index2line
from configHandler import idleConf from configHandler import idleConf
@ -166,10 +164,10 @@ class LastOpenBracketFinder:
if i is None \ if i is None \
or keysym_type(buf[i]) != right_keysym_type: or keysym_type(buf[i]) != right_keysym_type:
return None return None
lines_back = string.count(buf[i:], "\n") - 1 lines_back = buf[i:].count("\n") - 1
# subtract one for the "\n" added to please the parser # subtract one for the "\n" added to please the parser
upto_open = buf[:i] upto_open = buf[:i]
j = string.rfind(upto_open, "\n") + 1 # offset of column 0 of line j = upto_open.rfind("\n") + 1 # offset of column 0 of line
offset = i - j offset = i - j
return "%d.%d" % (lno - lines_back, offset) return "%d.%d" % (lno - lines_back, offset)