search-n-replace

--HG--
branch : pmacs2
This commit is contained in:
moculus 2008-12-05 05:38:08 +00:00
parent 6fccb54b16
commit 3d33459c2d
1 changed files with 20 additions and 23 deletions

View File

@ -2,42 +2,39 @@ import os
import util import util
# default callbacks # default callbacks
def none(window): def none(w):
return None return None
def last_buffer(window): def last_buffer(w):
bl = window.application.bufferlist bl = w.application.bufferlist
if bl.hidden_buffers: if bl.hidden_buffers:
return bl.hidden_buffers[0].name() return bl.hidden_buffers[0].name()
else: else:
return '' return ''
def current_buffer(window): def current_buffer(w):
return window.buffer.name() return w.buffer.name()
def last_replace_before(window): def last_replace_before(w):
return None #XYZ a = w.application
if window.application.last_replace_before: if a.config.get('use_last_replace') and a.last_replace_before:
return window.application.last_replace_before return a.last_replace_before
else: return None
return None def last_replace_after(w):
a = w.application
if a.config.get('use_last_replace') and a.last_replace_after:
return w.application.last_replace_after
return None
def last_replace_after(window): def current_working_dir(w):
return None #XYZ
if window.application.last_replace_after:
return window.application.last_replace_after
else:
return None
def current_working_dir(window):
return util.normal_path(os.getcwd()) return util.normal_path(os.getcwd())
def path_dirname(window): def path_dirname(w):
if hasattr(window.buffer, 'path'): if hasattr(w.buffer, 'path'):
path = os.path.dirname(window.buffer.path) path = os.path.dirname(w.buffer.path)
return util.normal_path(path) + '/' return util.normal_path(path) + '/'
else: else:
return current_working_dir(window) return current_working_dir(w)
# default callback builders # default callback builders
def build_constant(c): def build_constant(c):