def run(self, _, **kwargs):
# Lookup the sublime buffer instance for this view the first time this
# command is called
if self._sub_buffer is None:
self._sub_buffer = SublimeBufferManager.load_from_id(self.view.id())
if type(kwargs["key"]) is not str:
sublime.error_message("Terminal View: Got keypress with non-string key")
return
if "meta" in kwargs and kwargs["meta"]:
sublime.error_message("Terminal View: Meta key is not supported yet")
return
if "meta" not in kwargs:
kwargs["meta"] = False
if "alt" not in kwargs:
kwargs["alt"] = False
if "ctrl" not in kwargs:
kwargs["ctrl"] = False
if "shift" not in kwargs:
kwargs["shift"] = False
# Lookup the sublime buffer instance for this view
sublime_buffer = SublimeBufferManager.load_from_id(self.view.id())
keypress_cb = sublime_buffer.keypress_callback()
app_mode = sublime_buffer.terminal_emulator().application_mode_enabled()
if keypress_cb:
keypress_cb(kwargs["key"], kwargs["ctrl"], kwargs["alt"],
kwargs["shift"], kwargs["meta"], app_mode)
评论列表
文章目录