Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Standardize transpose logic. Add basic support for transposing multibyte characters. #45499
Mar 26, 2018
While developing my transpose extension and comparing existing implementations, I noticed differences between the macOS and emacs implementation.
If you have the cursor immediately before B:
I don't know if you care about fixing corner cases, but this might be a useful thing to be aware of, at least.
@Zarel when was this? In current macOS, the behaviour is as you described for emacs, except the cursor remains on the same line:
This, to me, is the most logical because the typical (non-endline) behaviour of transpose is "swap char before with char after, then move cursor after the swapped pair". In this case char before is newline, char after is
In fact, now that I look at it, emacs puts the cursor on the next line as well, so I think all is well.
With this PR, vscode exactly mirrors TextEdit (except in weird multi-byte corner cases that I mostly but not entirely removed), which I believe also means it exactly mirrors emacs (except emacs doesn't seem to handle multi-byte at all).
Nice extension BTW, "splitIntoLines" seems great. Might have to take it.