Skip to content

Commit 5fb9855

Browse files
authored
Merge pull request #101 from chrishrb/91-problem-with-escaped-underscores-in-vimlspbufhover-floating-window
91 Fix problem with escaped underscores
2 parents 394aa7e + 1d16a66 commit 5fb9855

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

lua/gx/handlers/url.lua

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,15 @@ function M.handle(mode, line, _)
1818
pattern = "([a-zA-Z%d_/%-%.~@\\+#]+%.[a-zA-Z_/%%%-%.~@\\+#=?&:]+)"
1919
url = helper.find(line, mode, pattern)
2020
if url then
21-
return "https://" .. url
21+
url = "https://" .. url
2222
end
2323
end
2424

25-
return url
25+
if not url then
26+
return
27+
end
28+
29+
return url:gsub("\\([%p])", "%1")
2630
end
2731

2832
return M

test/spec/gx/handlers/url_spec.lua

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,13 @@ describe("url_parser_does_work", function()
3737
"http://localhost:8080/backend/swagger-ui/#/project-controller",
3838
handler.handle("v", "http://localhost:8080/backend/swagger-ui/#/project-controller")
3939
)
40+
assert.equals(
41+
"https://golang-jwt.github.io/jwt/usage/signing_methods/#signing-methods-and-key-types",
42+
handler.handle(
43+
"v",
44+
"https://golang-jwt.github.io/jwt/usage/signing\\_methods/#signing-methods-and-key-types"
45+
)
46+
)
4047
end)
4148

4249
it("urls in python", function()

0 commit comments

Comments
 (0)