Skip to content

Add "Transpose Words" feature

Similar to "Transpose Characters", the word at the current cursor position is swapped with the next word (or the previous word if there is no next word in the line). Since KateView::word[Left|Right] is used, the next word would be the word to the right for LTR layouts and the word to the left for RTL layouts. The cursor's relative position inside the word is also preserved.

For example, before transpose: wor|d1 word2

after transpose: word2 wor|d1

BUG: 436621

kate-transpose-word

Even though the "Transpose Characters" feature technically swaps the character at the cursor position with the character to the left, in normal mode it looks like the character is "swapped forward", so the transpose words feature implemented here also "swaps forward" (swap current word with the next word). As I don't transpose words too often, I'm not sure if it would be better to "swap backward", but for now I'll keep it consistent with "Transpose Characters". I'm also not sure what a good shortcut will be as Ctrl+Shift+T is already used

Edited by Jan Paul Batrina

Merge request reports

Loading