One common typing mistake is to transpose two letters. The bash UNIX shell command line editor (based on emacs I think) handles this by allowing you to place your cursor between the two letters and hitting Ctrl + T. This will flip the two letters on either side of the and correct the mistake.
I am filing this issue to request that NetBeans provide exactly the same feature by default.
A simple implementation could just bind Ctrl+T to the following macro:
selection-backward cut-to-clipboard caret-forward paste-from-clipboard
but it would be better if the implementation didn't replace whatever might have been in the clipboard.
What about using the spellchecker module? Transposing letters is nice, but you have to know that the spelling is wrong in the first place.
No, I don't think the spellchecker module could do what I request. It's mainly for mistakes in human language, whereas mine can fix mistakes in human or programming language.
To be clear, let me give an example. If you type this:
ArrayList x = new ArryaList();
You could put the cursor between the 'y' and the 'a' in the class name and press Ctrl+T. That would flip the position of those two letters and correct the class name.
Since transposition is a common mistake (for me, anyway) it would be handy to have this feature in NetBeans, just like it already exists in emacs and bash.
Ok, I understand, so I'll make a new action:
Localized name: "Transpose Letters"
I'll attempt to finish it within 7.1 timeframe, it should be easy.
Oops. Although it's already past feature freeze, I've added it into 7.1.
Integrated into 'main-golden', will be available in build *201109040600* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
User: Miloslav Metelka <email@example.com>
Log: #176314 - Add support for 'transpose' action to NetBeans editor.
Perfect -- I just verified that this feature works exactly as I'd intended using a nightly build:
Product Version: NetBeans IDE Dev (Build 201109040600)
Java: 1.6.0_25; Java HotSpot(TM) Client VM 20.0-b11
System: Windows XP version 5.1 running on x86; Cp1252; en_US (nb)
Thank you for implementing it!