replace-done added

--HG--
branch : pmacs2
This commit is contained in:
moculus 2008-04-02 23:37:44 +00:00
parent a9e1c757af
commit e858fa7ba7
1 changed files with 10 additions and 2 deletions

View File

@ -12,6 +12,7 @@ class Replace(mode.Fundamental):
self.bindings = {}
self.add_action_and_bindings(ReplaceAll(), ('a', '!',))
self.add_action_and_bindings(ReplaceDone(), ('d',))
self.add_action_and_bindings(ReplaceOne(), ('y', 'SPACE',))
self.add_action_and_bindings(SkipReplace(), ('n', 'DELETE',))
self.add_action_and_bindings(CancelReplace(), ('q', 'RETURN', 'C-]', 'C-n', 'C-p', 'C-a', 'C-e', 'C-f', 'C-b'))
@ -30,6 +31,13 @@ class ReplaceOne(method.Method):
_find_next(m, False)
_finish(m, w)
class ReplaceDone(method.Method):
def execute(self, w, **vargs):
m = w.buffer.method
_replace(m)
_end(w)
w.set_error("Replace done")
class SkipReplace(method.Method):
def execute(self, w, **vargs):
m = w.buffer.method
@ -83,9 +91,9 @@ def _set_prompt(m):
y += 1
x = 0
if count > 1:
p = 'Replace %r with %r [ynaq] (%d occurances)?' % (m.before, m.after, count)
p = 'Replace %r with %r [ynadq] (%d occurances)?' % (m.before, m.after, count)
else:
p = 'Replace %r with %r [ynaq] (1 occurance)?' % (m.before, m.after)
p = 'Replace %r with %r [ynadq] (1 occurance)?' % (m.before, m.after)
w.application.mini_prompt = p
def _replace(m):