This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 176314 - Add support for 'transpose' action to NetBeans editor
Summary: Add support for 'transpose' action to NetBeans editor
Status: VERIFIED FIXED
Alias: None
Product: editor
Classification: Unclassified
Component: Actions/Menu/Toolbar (show other bugs)
Version: 6.x
Hardware: PC Windows XP
: P3 normal (vote)
Assignee: Miloslav Metelka
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-11-09 17:57 UTC by tomwheeler
Modified: 2011-09-06 15:45 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description tomwheeler 2009-11-09 17:57:12 UTC
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.
Comment 1 Vitezslav Stejskal 2009-11-10 03:22:31 UTC
What about using the spellchecker module? Transposing letters is nice, but you have to know that the spelling is wrong in the first place.
Comment 2 tomwheeler 2011-08-03 16:08:12 UTC
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.
Comment 3 Miloslav Metelka 2011-08-04 09:30:51 UTC
Ok, I understand, so I'll make a new action:
Name: "transpose-letters"
Localized name: "Transpose Letters"
Shortcut: Ctrl+T
I'll attempt to finish it within 7.1 timeframe, it should be easy.
Comment 4 Miloslav Metelka 2011-09-03 21:43:53 UTC
Oops. Although it's already past feature freeze, I've added it into 7.1.
http://hg.netbeans.org/jet-main/rev/b713954c7149
Comment 5 Quality Engineering 2011-09-04 14:13:02 UTC
Integrated into 'main-golden', will be available in build *201109040600* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/b713954c7149
User: Miloslav Metelka <mmetelka@netbeans.org>
Log: #176314 - Add support for 'transpose' action to NetBeans editor.
Comment 6 tomwheeler 2011-09-06 15:45:23 UTC
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!