From: Simon Tatham Date: Fri, 8 Dec 2023 12:56:48 +0000 (+0000) Subject: Editor: ^W and ^T to go forward/back a word X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ian/git?a=commitdiff_plain;h=b691f391d095d7265658b1b525534efa6a302dda;p=mastodonochrome.git Editor: ^W and ^T to go forward/back a word --- diff --git a/cursesclient.py b/cursesclient.py index 5e7455f..716a4bd 100644 --- a/cursesclient.py +++ b/cursesclient.py @@ -992,6 +992,18 @@ class Composer(Activity): if self.point < len(self.text): self.text = (self.text[:self.point] + self.text[self.point + 1:]) + elif ch in {ctrl('w')}: + if self.point > 0: + while True: + self.point -= 1 + if self.word_boundary(self.point): + break + elif ch in {ctrl('t')}: + if self.point < len(self.text): + while True: + self.point += 1 + if self.word_boundary(self.point): + break elif ch in {'\r', '\n'}: self.text = (self.text[:self.point] + '\n' + self.text[self.point:])