pmacs3/mode_mini.py

42 lines
1.3 KiB
Python
Raw Normal View History

2007-06-05 00:49:24 -04:00
import method, mode2
2007-03-06 10:05:38 -05:00
2007-06-05 00:49:24 -04:00
class Mini(mode2.Fundamental):
2007-03-06 10:05:38 -05:00
'''This is the default mode'''
def __init__(self, w):
2007-06-05 00:49:24 -04:00
mode2.Fundamental.__init__(self, w)
2007-03-06 10:05:38 -05:00
# delete actions relating to multiple lines
self.del_action('center-view')
self.del_action('next-line')
self.del_action('previous-line')
self.del_action('page-down')
self.del_action('page-up')
self.del_action('goto-beginning')
self.del_action('goto-end')
self.del_action('switch-buffer')
# add some new actions for the minibuffer
self.add_action_and_bindings(MiniCallback(), ('RETURN',))
self.add_action_and_bindings(MiniTabComplete(), ('TAB',))
#self.add_action_and_bindings(MiniCancel(), ('C-]',))
def name(self):
return "Mini"
class MiniCallback(method.Method):
def execute(self, window, **vargs):
window.buffer.do_callback()
class MiniTabComplete(method.Method):
def __init__(self):
self.name = "tab-complete"
self.args = []
def execute(self, window, **vargs):
b = window.buffer
if b.tabber is None:
window.application.set_error("No tab completion")
return
s1 = b.make_string()
s2, exists, complete = b.tabber.tab_string(s1, window)
b.set_data(s2)