maybe fixed a replace bug

--HG--
branch : pmacs2
This commit is contained in:
moculus 2007-07-19 04:57:43 +00:00
parent 1133f643fb
commit 6afec24fe0
1 changed files with 6 additions and 5 deletions

View File

@ -17,7 +17,7 @@ class Replace(mode2.Fundamental):
self.add_action_and_bindings(CancelReplace(), ('q', 'RETURN', 'C-]', 'C-n', 'C-p', 'C-a', 'C-e', 'C-f', 'C-b')) self.add_action_and_bindings(CancelReplace(), ('q', 'RETURN', 'C-]', 'C-n', 'C-p', 'C-a', 'C-e', 'C-f', 'C-b'))
m = w.buffer.method m = w.buffer.method
found = _find_next(m, move=False) found = _find_next(m, False)
if not found: if not found:
w.set_error('%r was not found' % m.before) w.set_error('%r was not found' % m.before)
raise minibuffer.MiniBufferError raise minibuffer.MiniBufferError
@ -29,13 +29,13 @@ class ReplaceOne(method.Method):
def execute(self, w, **vargs): def execute(self, w, **vargs):
m = w.buffer.method m = w.buffer.method
_replace(m) _replace(m)
_find_next(m, True) _find_next(m, False)
_finish(m, w) _finish(m, w)
class SkipReplace(method.Method): class SkipReplace(method.Method):
def execute(self, w, **vargs): def execute(self, w, **vargs):
m = w.buffer.method m = w.buffer.method
_find_next(m, True) _find_next(m, False)
_finish(m, w) _finish(m, w)
class ReplaceAll(method.Method): class ReplaceAll(method.Method):
@ -43,7 +43,7 @@ class ReplaceAll(method.Method):
m = w.buffer.method m = w.buffer.method
while m.p1 is not None: while m.p1 is not None:
_replace(m) _replace(m)
_find_next(m, True) _find_next(m, False)
_end(w) _end(w)
w.set_error("Replace ended") w.set_error("Replace ended")
@ -62,7 +62,8 @@ def _find_next(m, move=False):
(m.p1, m.p2) = (None, None) (m.p1, m.p2) = (None, None)
return False return False
newc = search.find_next(r, w, move, start=c.add(1, 0)) #newc = search.find_next(r, w, move, start=c.add(1, 0))
newc = search.find_next(r, w, move, start=c.add(0, 0))
if newc: if newc:
(m.p1, m.p2) = newc (m.p1, m.p2) = newc
return True return True