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.
In some languages (e.g. HTML, PHP) you can select text and press quote (', ") and selected text is given to quotes. This is not possible implemented with typing hooks implementation. We need new API to enable this.
Created attachment 130592 [details] patch for getReplacedText Api I propose new method getReplacedText. I changed implementation to obtain replacedText during creation of interceptor. Example for use, this would enable in java selecting text and pressing quote to give text in quotes. --- a/java.editor/src/org/netbeans/modules/editor/java/TypingCompletion.java +++ b/java.editor/src/org/netbeans/modules/editor/java/TypingCompletion.java @@ -259,7 +259,11 @@ } if ((completablePosition && !insideString) || eol) { - context.setText(context.getText() + context.getText(), 1); + if (context.getReplacedText() != null) { + context.setText(context.getText() + context.getReplacedText() + context.getText(), context.getReplacedText().length() + 1); + } else { + context.setText(context.getText() + context.getText(), 1); + } } return -1; }
Created attachment 130593 [details] patch for getReplacedText Api new patch - fixed changes.xml
http://hg.netbeans.org/jet-main/rev/5405efa8ac8a
Integrated into 'main-golden', will be available in build *201301310001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-golden/rev/5405efa8ac8a User: Milutin Kristofic <mkristofic@netbeans.org> Log: #225293 - TypedTextinterceptor needs method to get Replaced Text.