Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!
Bug 225293 - TypedTextinterceptor needs method to get Replaced Text.
TypedTextinterceptor needs method to get Replaced Text.
Status: RESOLVED FIXED
Product: editor
Classification: Unclassified
Component: -- Other --
7.3
PC Linux
: P3 (vote)
: 7.4
Assigned To: Milutin Kristofic
issues@editor
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-01-24 15:00 UTC by Milutin Kristofic
Modified: 2013-01-31 03:13 UTC (History)
0 users

See Also:
Issue Type: DEFECT
:


Attachments
patch for getReplacedText Api (7.14 KB, patch)
2013-01-24 15:08 UTC, Milutin Kristofic
Details | Diff
patch for getReplacedText Api (7.16 KB, patch)
2013-01-24 15:11 UTC, Milutin Kristofic
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Milutin Kristofic 2013-01-24 15:00:26 UTC
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.
Comment 1 Milutin Kristofic 2013-01-24 15:08:49 UTC
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;
     }
Comment 2 Milutin Kristofic 2013-01-24 15:11:00 UTC
Created attachment 130593 [details]
patch for getReplacedText Api

new patch - fixed changes.xml
Comment 3 Milutin Kristofic 2013-01-30 10:34:46 UTC
http://hg.netbeans.org/jet-main/rev/5405efa8ac8a
Comment 4 Quality Engineering 2013-01-31 03:13:57 UTC
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.


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo