29 lines
795 B
Python
29 lines
795 B
Python
import buffer2
|
|
|
|
class MiniBufferError(Exception):
|
|
pass
|
|
|
|
# minibuffer is a singleton
|
|
mini = None
|
|
class MiniBuffer(buffer2.Buffer):
|
|
btype = 'mini'
|
|
def __new__(cls, *args, **kwargs):
|
|
global mini
|
|
if mini is None:
|
|
mini = object.__new__(MiniBuffer, *args, **kwargs)
|
|
return mini
|
|
# the callback function should take one argument (window)
|
|
def __init__(self, func, method=None, tabber=None, modename=None):
|
|
buffer2.Buffer.__init__(self)
|
|
self.callback = func
|
|
self.method = method
|
|
self.tabber = tabber
|
|
self.modename = modename
|
|
def name(self):
|
|
return "*Minibuffer*"
|
|
def do_callback(self):
|
|
self.callback(self.make_string())
|
|
def close(self):
|
|
global mini
|
|
mini = None
|