fixed at least part of the reverse-search bug

--HG--
branch : pmacs2
This commit is contained in:
moculus 2007-07-18 16:15:43 +00:00
parent 085e2e2f9e
commit 46598bcad2
1 changed files with 14 additions and 5 deletions

View File

@ -52,18 +52,27 @@ def find(r, w, move=False, direction='next', start=None, end=None):
offset = 0
if direction == 'next':
limit = Point(x - 1 + offset, y)
else:
elif direction == 'previous':
limit = Point(x + 1 - offset, y)
for stuff in app.highlighted_ranges:
(wz, p1, p2, fg, bg) = stuff
if p1.y == c.y and p1.x == c.x:
limit = Point(x + 1 + p2.x - p1.x - offset, y)
#if p1.y == c.y and p1.x == c.x:
if p1 == c:
#raise Exception, "argh you got me: %d (%d + 1 + %d - %d - %d), %d" % (x + 1 + p2.x - p1.x - offset, x, p2.x, p1.x, offset, y)
limit = Point(x + 1 + p2.x - p1.x - 2*offset + 1, y)
break
indices.reverse()
else:
raise Exception, 'blech'
for i in indices:
if ((direction == 'next' and ranges[i][0] > limit) or
(direction != 'next' and ranges[i][1] < limit)):
if direction == 'next' and ranges[i][0] > limit:
ranges[i][3] = selected_color
#assert ranges[i][0] > c, "%r > %r" % (ranges[i][0], c)
newc = (ranges[i][0], ranges[i][1])
break
elif direction == 'previous' and ranges[i][1] < limit:
ranges[i][3] = selected_color
#assert ranges[i][1] < c, "%r < %r" % (ranges[i][1], c)
newc = (ranges[i][0], ranges[i][1])
break
if ranges and not newc: