From d41730efa09ca9b27ad8166c4239b34f98c0960f Mon Sep 17 00:00:00 2001 From: obo Date: Thu, 6 Jul 2023 20:20:50 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-99850=20=E5=85=AC=E5=BC=8F=E9=9D=A2?= =?UTF-8?q?=E6=9D=BF=20=E5=9C=A8=E5=8F=82=E6=95=B0=E5=90=8E=E6=8C=89?= =?UTF-8?q?=E4=BB=BB=E6=84=8F=E5=AD=97=E6=AF=8D=E9=83=BD=E4=BC=9A=E5=8F=98?= =?UTF-8?q?=E6=88=90$=E7=AC=A6=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AbstractCompletionProvider.java | 8 ++++++-- .../FormulaPaneAutoCompletion.java | 19 +++++++++++++------ 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/autocomplete/AbstractCompletionProvider.java b/designer-base/src/main/java/com/fr/design/gui/autocomplete/AbstractCompletionProvider.java index a03e3d8b00..ceacb715ce 100644 --- a/designer-base/src/main/java/com/fr/design/gui/autocomplete/AbstractCompletionProvider.java +++ b/designer-base/src/main/java/com/fr/design/gui/autocomplete/AbstractCompletionProvider.java @@ -8,12 +8,14 @@ */ package com.fr.design.gui.autocomplete; +import com.fr.stable.StringUtils; + +import javax.swing.text.JTextComponent; import java.io.Serializable; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.List; -import javax.swing.text.JTextComponent; /** @@ -186,7 +188,9 @@ public abstract class AbstractCompletionProvider while (index 0) ? text.substring(index - 1, index) : ""; + //补全内容在FormulaPane中的前缀,例如参数para1会返回$,不存在返回"" + String paramPrefix = FormulaPane.getParamPrefix(replacement); + //如果前缀和字符对不上需要补上,相同时直接补全字符串本身即可 + if (!FormulaPane.getParamPrefix(replacement).equals(prefix)) { + replacement = paramPrefix + replacement; + } + textComp.replaceSelection(replacement); } else { textComp.replaceSelection(replacement + "()"); int caretPosition = textComp.getCaretPosition();