Skip to content

Commit d57a4b1

Browse files
committed
Merge branch 'topic/internal_url' into 'master'
Add an user preference for internal URL handling Closes #537 See merge request eng/ide/gnatstudio!868
2 parents 3f66db9 + 510afc8 commit d57a4b1

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

share/support/core/url.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,16 @@
77

88

99
import GPS
10+
import re
11+
12+
internal_url_regexp = None
1013

1114
# Callback for {file,http*}:// URLs
1215

1316

1417
def view_url(url):
1518
try:
16-
if url.startswith("file"):
19+
if re.search(internal_url_regexp.get(), url):
1720
GPS.MDI.get_by_child(
1821
GPS.EditorBuffer.get(GPS.File(url[7:])).current_view()
1922
).raise_window()
@@ -27,3 +30,12 @@ def view_url(url):
2730
GPS.EditorHighlighter(
2831
r"(file:[\\/][\\/][^\s]*|http(s)?://[^\s:,]*)", view_url, 0, view_url
2932
)
33+
34+
internal_url_regexp = \
35+
GPS.Preference("External Commands:Browser/gs_regexp").create(
36+
"Internal browsing URLs",
37+
"string",
38+
"URL pattern to be opened within GNAT Studio;"
39+
+ " others will open externally.",
40+
"^file:",
41+
)

0 commit comments

Comments
 (0)