def delete_forward_word(self): i = self.cursor + 1 s = util.U(self.text) while i < len(s): if self.wordbreakchars.search(s[i]): break i += 1 delword = s[self.cursor : i] self.text = util.slicestr(self.text, self.cursor, i) del self.textmap[self.cursor : i] self.edithook() self.yankhook(delword)
def delete_backward_word(self): if not self.cursor: return i = self.cursor - 1 s = util.U(self.text) while 0 < i: if self.wordbreakchars.search(s[i - 1]): break i -= 1 delword = s[i : self.cursor] self.text = util.slicestr(self.text, i, self.cursor) del self.textmap[i : self.cursor] self.cursor = i self.edithook() self.yankhook(delword)