mirror of
https://github.com/python/cpython.git
synced 2025-11-11 14:44:57 +00:00
Properly fix SF bug #507298 (Gregor Lingl): shellpython2.2 -Qnew smart
indent error Use // where int division is intended. (This breaks IDLE for use with previous Python versions -- I don't care.)
This commit is contained in:
parent
af14289c54
commit
64e9d61a1e
2 changed files with 3 additions and 3 deletions
|
|
@ -171,7 +171,7 @@ class AutoIndent:
|
||||||
expand, tabwidth = string.expandtabs, self.tabwidth
|
expand, tabwidth = string.expandtabs, self.tabwidth
|
||||||
have = len(expand(chars, tabwidth))
|
have = len(expand(chars, tabwidth))
|
||||||
assert have > 0
|
assert have > 0
|
||||||
want = int((have - 1) / self.indentwidth) * self.indentwidth
|
want = int((have - 1) // self.indentwidth) * self.indentwidth
|
||||||
ncharsdeleted = 0
|
ncharsdeleted = 0
|
||||||
while 1:
|
while 1:
|
||||||
chars = chars[:-1]
|
chars = chars[:-1]
|
||||||
|
|
@ -495,7 +495,7 @@ def classifyws(s, tabwidth):
|
||||||
effective = effective + 1
|
effective = effective + 1
|
||||||
elif ch == '\t':
|
elif ch == '\t':
|
||||||
raw = raw + 1
|
raw = raw + 1
|
||||||
effective = (int(effective / tabwidth) + 1) * tabwidth
|
effective = (effective // tabwidth + 1) * tabwidth
|
||||||
else:
|
else:
|
||||||
break
|
break
|
||||||
return raw, effective
|
return raw, effective
|
||||||
|
|
|
||||||
|
|
@ -465,7 +465,7 @@ class EditorWindow:
|
||||||
top, bot = self.getwindowlines()
|
top, bot = self.getwindowlines()
|
||||||
lineno = self.getlineno(mark)
|
lineno = self.getlineno(mark)
|
||||||
height = bot - top
|
height = bot - top
|
||||||
newtop = max(1, lineno - height/2)
|
newtop = max(1, lineno - height//2)
|
||||||
text.yview(float(newtop))
|
text.yview(float(newtop))
|
||||||
|
|
||||||
def getwindowlines(self):
|
def getwindowlines(self):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue