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.
If I have a custom implementation of TypedTextInterceptor and want to use "selection" feature (user selects some text, types e.g. ", and the result is that the selected text is encapsulated by "..") with the caret at the end of the inserted text, it fails on Assertion error (BaseKit:1286). API says that one can use: String selection = context.getReplacedText(); String text = "\"" + selection + "\""; context.setText(text, text.getLength()); // here is the problem Possible fix is to change assert in BaseKit:1286 to: assert caretPosition >= 0 && (caretPosition <= insertionText.length() || (insertionText.isEmpty() && caretPosition == 0)); The difference is equals sign in: caretPosition <= insertionText.length() Thanks.
Thank you, you are right, I added special case with empty text, but it should be able with any length and any caret on the end of text. http://hg.netbeans.org/jet-main/rev/e13d6a595745
Integrated into 'main-golden', will be available in build *201303082300* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-golden/rev/e13d6a595745 User: Milutin Kristofic <mkristofic@netbeans.org> Log: #227176 - Typinghooks API doesn't work properly