aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzzhongwei2012-12-03 21:44:39 (EST)
committerzzhongwei2012-12-03 21:44:39 (EST)
commitfb80c250798ff710b29d0fdebaa06eb1fb18ac5e (patch)
tree77ea90f683fd8469c7ab90741016a72d33cdee35
parentabd0f3c32eea98643727299d5801a744925fd5e9 (diff)
downloadorg.eclipse.pdt-fb80c250798ff710b29d0fdebaa06eb1fb18ac5e.zip
org.eclipse.pdt-fb80c250798ff710b29d0fdebaa06eb1fb18ac5e.tar.gz
org.eclipse.pdt-fb80c250798ff710b29d0fdebaa06eb1fb18ac5e.tar.bz2
395654: Content Assist bug- when Ctrl is pressed,overwrite mode does not
work. https://bugs.eclipse.org/bugs/show_bug.cgi?id=395654
-rw-r--r--plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/editor/contentassist/PHPCompletionProposal.java8
-rw-r--r--plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/editor/contentassist/ParameterGuessingProposal.java19
2 files changed, 25 insertions, 2 deletions
diff --git a/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/editor/contentassist/PHPCompletionProposal.java b/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/editor/contentassist/PHPCompletionProposal.java
index 7ea975f..d81611d 100644
--- a/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/editor/contentassist/PHPCompletionProposal.java
+++ b/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/editor/contentassist/PHPCompletionProposal.java
@@ -76,6 +76,14 @@ public class PHPCompletionProposal extends ScriptCompletionProposal {
}
public void apply(IDocument document, char trigger, int offset) {
+ boolean toggleEating = isToggleEating();
+ boolean instertCompletion = insertCompletion();
+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=395654
+ // workaround for GlobalTypesStrategy.getReplacementRange()
+ if (instertCompletion && toggleEating) {
+ setReplacementLength(getReplacementLength() + 1);
+ }
+
IModelElement modelElement = getModelElement();
boolean activateCodeAssist = false;
diff --git a/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/editor/contentassist/ParameterGuessingProposal.java b/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/editor/contentassist/ParameterGuessingProposal.java
index 9e7885c..cd8525a 100644
--- a/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/editor/contentassist/ParameterGuessingProposal.java
+++ b/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/editor/contentassist/ParameterGuessingProposal.java
@@ -170,10 +170,25 @@ public final class ParameterGuessingProposal extends
}
private void dealSuffix(IDocument document, int offset) {
+ boolean toggleEating = isToggleEating();
+ boolean instertCompletion = insertCompletion();
+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=395654
+ // workaround for GlobalTypesStrategy.getReplacementRange()
+ if (instertCompletion && toggleEating) {
+ setReplacementLength(getReplacementLength() + 1);
+ }
+
String replacement = getReplacementString();
if (replacement.endsWith(RPAREN)) {
- if (cursorInBrackets(document, offset + 1)) {
- setReplacementLength(getReplacementLength() + 2);
+ if (instertCompletion && toggleEating) {
+ if (cursorInBrackets(document, getReplacementOffset()
+ + getReplacementLength() + 1)) {
+ setReplacementLength(getReplacementLength() + 2);
+ }
+ } else {
+ if (cursorInBrackets(document, offset + 1)) {
+ setReplacementLength(getReplacementLength() + 2);
+ }
}
} else {
// deal with case that a method that do not have parameters but with