def input(self, key): if key in self.keymap: self.keymap[key]() elif util.mbslen(key) == 1: self.insert(key) else: return True
def input(self, key): if key in self.keymap: self.keymap[key]() else: if key == "SPC": self.insert(" ") elif util.mbslen(key) == 1: self.insert(key)
def start(self, mode, text="", pos=-1): self.mode = mode self.settext(text) self.show() self.prompt = self.mode.prompt if pos >= 0: self.cursor = pos else: self.cursor = util.mbslen(self.text) + 1 + pos self.history.start()
def input(self, key): if key in self.keymap: self.keymap[key]() elif key == "SPC": self.textbox.insert(" ") elif util.mbslen(key) == 1: self.textbox.insert(key) else: self.finish() self.cmdline.input(key)
def insert(self, entry=None): if entry is None: entry = self.cursor_entry() escape = False if self.cmdline.mode.__class__.__name__ == "Shell" and \ not self.parser.now_in_quote() and \ not isinstance(entry, Argument): escape = True text = entry.match(self.parser.part[1]) if escape: text = util.string_to_safe(text) self.cmdline.settext(self.parser.part[0] + text + self.parser.part[2]) self.cmdline.cursor = util.mbslen(self.parser.part[0]+text) self.finish()
def setbottom(self): self.cursor = util.mbslen(self.text)