def finalize(self): try: if self.fm.py3: xpos = sum(utf_char_width_(ord(c)) for c in self.line[0 : self.pos]) + len(self.prompt) else: xpos = uwid(self.line[0 : self.pos]) + len(self.prompt) self.fm.ui.win.move(self.y, self.x + min(self.wid - 1, xpos)) except: pass
def draw(self): self.win.erase() self.addstr(0, 0, self.prompt) overflow = -self.wid + len(self.prompt) + uwid(self.line) + 1 if overflow > 0: #XXX: cut uft-char-wise, consider width self.addstr(self.line[overflow:]) else: self.addstr(self.line)
def finalize(self): try: if self.fm.py3: xpos = sum(utf_char_width_(ord(c)) for c in self.line[0:self.pos]) \ + len(self.prompt) else: xpos = uwid(self.line[0:self.pos]) + len(self.prompt) self.fm.ui.win.move(self.y, self.x + min(self.wid - 1, xpos)) except: pass
def draw(self): self.win.erase() self.addstr(0, 0, self.prompt) if self.fm.py3: overflow = -self.wid + len(self.prompt) + len(self.line) + 1 else: overflow = -self.wid + len(self.prompt) + uwid(self.line) + 1 if overflow > 0: #XXX: cut uft-char-wise, consider width self.addstr(self.line[overflow:]) else: self.addstr(self.line)
def __len__(self): return uwid(self.string)
def finalize(self): try: xpos = uwid(self.line[0:self.pos]) + len(self.prompt) self.fm.ui.win.move(self.y, self.x + min(self.wid-1, xpos)) except: pass