34 lines
1.1 KiB
Python
34 lines
1.1 KiB
Python
import color, method, mode2
|
|
from point import Point
|
|
|
|
class Which(mode2.Fundamental):
|
|
modename = 'Which'
|
|
def __init__(self, w):
|
|
mode2.Fundamental.__init__(self, w)
|
|
old_mode = w.buffer.method.old_window.mode
|
|
self.bindings = dict(old_mode.bindings)
|
|
def handle_token(self, t):
|
|
'''self.handle_token(token): handles input "token"'''
|
|
self.window.active_point = None
|
|
try:
|
|
act = mode2.Handler.handle_token(self, t)
|
|
if act is None:
|
|
return
|
|
else:
|
|
s = '%r is %r: %s' % (self.last_sequence, act.name, act.help)
|
|
self.window.application.set_error(s)
|
|
self._end()
|
|
except Exception, e:
|
|
if mode2.DEBUG:
|
|
raise
|
|
else:
|
|
err = "%s in mode '%s'" % (e, self.name())
|
|
self.window.application.set_error(err)
|
|
self._end()
|
|
def _end(self):
|
|
self.window.application.close_mini_buffer()
|
|
self.window.buffer.method.old_cursor = None
|
|
self.window.buffer.method.old_window = None
|
|
|
|
install = Which.install
|