2007-10-21 20:50:11 -04:00
|
|
|
import buffer
|
2007-03-06 10:05:38 -05:00
|
|
|
|
2007-06-18 14:50:48 -04:00
|
|
|
class MiniBufferError(Exception):
|
|
|
|
pass
|
|
|
|
|
2007-03-06 10:05:38 -05:00
|
|
|
# minibuffer is a singleton
|
|
|
|
mini = None
|
2007-10-21 20:50:11 -04:00
|
|
|
class MiniBuffer(buffer.Buffer):
|
2007-07-19 14:37:39 -04:00
|
|
|
btype = 'mini'
|
2007-03-06 10:05:38 -05:00
|
|
|
def __new__(cls, *args, **kwargs):
|
|
|
|
global mini
|
|
|
|
if mini is None:
|
2008-03-16 16:26:32 -04:00
|
|
|
mini = object.__new__(MiniBuffer)
|
2007-03-06 10:05:38 -05:00
|
|
|
return mini
|
|
|
|
# the callback function should take one argument (window)
|
2009-07-06 22:48:34 -04:00
|
|
|
def __init__(self, func, app, method=None, tabber=None, modename=None,
|
|
|
|
queue=None):
|
2007-10-21 20:50:11 -04:00
|
|
|
buffer.Buffer.__init__(self)
|
2009-07-06 22:48:34 -04:00
|
|
|
self.app = app
|
2007-03-06 10:05:38 -05:00
|
|
|
self.callback = func
|
|
|
|
self.method = method
|
|
|
|
self.tabber = tabber
|
|
|
|
self.modename = modename
|
2009-07-06 22:48:34 -04:00
|
|
|
self.queue = queue
|
|
|
|
|
2007-03-06 10:05:38 -05:00
|
|
|
def name(self):
|
|
|
|
return "*Minibuffer*"
|
|
|
|
def do_callback(self):
|
|
|
|
self.callback(self.make_string())
|
|
|
|
def close(self):
|
|
|
|
global mini
|
|
|
|
mini = None
|