Skip to content

Commit 22721ee

Browse files
committed
WIP #971 Doesn't require * on search
1 parent 3235d10 commit 22721ee

File tree

3 files changed

+18
-10
lines changed

3 files changed

+18
-10
lines changed

symja_android_library/matheclipse-core/src/main/java/org/matheclipse/core/builtin/IOFunctions.java

+16-8
Original file line numberDiff line numberDiff line change
@@ -507,21 +507,29 @@ public static IAST getNamesByPattern(java.util.regex.Pattern pattern, EvalEngine
507507
return list;
508508
}
509509

510-
public static IAST getNamesByPrefix(String name) {
511-
510+
public static IAST getDocumentationByPrefix(String name, boolean useAsterisk) {
512511
if (name.length() == 0) {
513512
return F.CEmptyList;
514513
}
515-
final boolean exact;
516-
if (name.charAt(name.length() - 1) == '*') {
517-
name = name.substring(0, name.length() - 1);
514+
boolean exact = false;
515+
if (useAsterisk) {
516+
if (name.charAt(name.length() - 1) == '*') {
517+
name = name.substring(0, name.length() - 1);
518+
if (name.length() == 0) {
519+
return getAllNames();
520+
}
521+
} else {
522+
exact = true;
523+
}
524+
} else {
518525
if (name.length() == 0) {
519526
return getAllNames();
520527
}
521-
exact = false;
522-
} else {
523-
exact = true;
524528
}
529+
return getNamesByPrefix(name, exact);
530+
}
531+
532+
private static IAST getNamesByPrefix(String name, final boolean exact) {
525533
SuggestTree suggestTree = AST2Expr.getSuggestTree();
526534
// name = ParserConfig.PARSER_USE_LOWERCASE_SYMBOLS ? name.toLowerCase() : name;
527535
name = name.toLowerCase(Locale.US);

symja_android_library/matheclipse-core/src/main/java/org/matheclipse/core/form/Documentation.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public static void usageDocumentation(Appendable out, String name) {
8484
out.append(temp.toString());
8585
}
8686
}
87-
IAST list = IOFunctions.getNamesByPrefix(name);
87+
IAST list = IOFunctions.getDocumentationByPrefix(name, true);
8888

8989
if (list.size() > 2) {
9090
for (int i = 1; i < list.size(); i++) {

symja_android_library/matheclipse-io/src/main/java/org/matheclipse/io/servlet/AJAXSearchServlet.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ protected void doPost(HttpServletRequest req, HttpServletResponse res) throws IO
7070

7171
private static void findDocumentation(Appendable out, String trimmedInput) {
7272
String name = trimmedInput; // .substring(1);
73-
IAST list = IOFunctions.getNamesByPrefix(name);
73+
IAST list = IOFunctions.getDocumentationByPrefix(name, false);
7474
try {
7575
if (list.size() != 2) {
7676
for (int i = 1; i < list.size(); i++) {

0 commit comments

Comments
 (0)