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.
When executing the following macro select-identifier copy-to-clipboard caret-backward "if (" caret-end-line ") throw new IllegalArgumentException(\"" paste-from-clipboard ": \" + " paste-from-clipboard ");" caret-begin-line caret-next-word caret-next-word caret-next-word the caret ends up at the start of the document. This does not happen when the caret-begin-line command is removed from the macro. This is a regression, it was working correctly up to NB 6.9. The macro's purpose is to turn an identifier "foo" into if (foo) throw new IllegalArgumentException("foo: " + foo); The "caret-begin-line caret-next-word caret-next-word caret-next-word" should move the caret to after the "foo" within the conditional, so that a condition can be typed for "foo" (e.g. " < 0").
Hm; it seems that it is caused by Editor thinking that the atomic operation is lengthy (# of modifications within atomic lock exceeded some threshold). If inside "lengthy" operation, the DocumentOp starts to answer isActive() == false, which IMHO leads to an incorrect behaviour of viewToModelChecked: returns 0 for any coordinates and subsequently any mapping of coordinates > offset fails. So either viewModelToChecked should report proper char index, or editor Utilities.getRowStart should avoid offset > rectangle > offset re-mapping. If you have other suggestion, feel free to reassign back - thanks.
Integrated into 'main-golden' Changeset: http://hg.netbeans.org/main-golden/rev/efa1d8c49b70 User: Miloslav Metelka <mmetelka@netbeans.org> Log: #199695 - caret-begin-line jumps to start of document - partial fix.
*** Bug 196638 has been marked as a duplicate of this bug. ***
*** Bug 193485 has been marked as a duplicate of this bug. ***
I think this was fixed by Mila as the comment indicate.