Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/TextViewerTest.java3
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/URLHyperlinkDetector.java6
2 files changed, 8 insertions, 1 deletions
diff --git a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/TextViewerTest.java b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/TextViewerTest.java
index 8e79f41bd99..9de19b43ad4 100644
--- a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/TextViewerTest.java
+++ b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/TextViewerTest.java
@@ -418,6 +418,9 @@ public class TextViewerTest {
checkHyperlink(textViewer, 3, "https:// ", "[]");
checkHyperlink(textViewer, 3, "https:// foo", "[]");
checkHyperlink(textViewer, 3, "https://foo bar", "[https://foo]");
+ checkHyperlink(textViewer, 3, "\"https://\" foo bar", "[]");
+ checkHyperlink(textViewer, 3, "\"https:// \" foo bar", "[]");
+ checkHyperlink(textViewer, 3, "\"https:// foo\" bar", "[]");
checkHyperlink(textViewer, 15, "https:// foo https://bar bar", "[https://bar]");
checkHyperlink(textViewer, 24, "https:// foo https://bar bar", "[https://bar]");
checkHyperlink(textViewer, 15, "<a href=\"test:https://bugs.eclipse.org/bugs\"></a>", "[https://bugs.eclipse.org/bugs]");
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/URLHyperlinkDetector.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/URLHyperlinkDetector.java
index 2ad08986701..96bdefe2555 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/URLHyperlinkDetector.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/URLHyperlinkDetector.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * Copyright (c) 2000, 2021 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -146,6 +146,10 @@ public class URLHyperlinkDetector extends AbstractHyperlinkDetector {
urlLength= endOffset - urlOffsetInLine;
}
+ if (urlOffsetInLine + urlLength == urlSeparatorOffset + 3) {
+ return null; // Only "scheme://"
+ }
+
// Set and validate URL string
try {
urlString= line.substring(urlOffsetInLine, urlOffsetInLine + urlLength);

Back to the top