mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2024-11-09 20:44:03 -08:00
parent
336f351b98
commit
52f4ae662d
|
@ -144,14 +144,15 @@ func (a *Ansi) GenerateHyperlink(text string) string {
|
|||
var buffer strings.Builder
|
||||
var part string
|
||||
for i := range parts {
|
||||
part += parts[i]
|
||||
if strings.Contains(parts[i], "[") && !strings.Contains(parts[i], "]") {
|
||||
part += parts[i]
|
||||
continue
|
||||
}
|
||||
part += parts[i]
|
||||
buffer.WriteString(a.replaceHyperlink(part))
|
||||
part = ""
|
||||
}
|
||||
// when we did not process any parts, we return the original text
|
||||
buffer.WriteString(part)
|
||||
return buffer.String()
|
||||
}
|
||||
|
||||
|
|
|
@ -31,6 +31,11 @@ func TestGenerateHyperlinkWithUrl(t *testing.T) {
|
|||
ShellName string
|
||||
Expected string
|
||||
}{
|
||||
{
|
||||
Text: "in <accent>\x1b[1mpwsh \x1b[22m</> ",
|
||||
ShellName: shell.PWSH,
|
||||
Expected: "in <accent>\x1b[1mpwsh \x1b[22m</> ",
|
||||
},
|
||||
{
|
||||
Text: "[google](http://www.google.be) [maps (2/2)](http://maps.google.be)",
|
||||
ShellName: shell.FISH,
|
||||
|
|
Loading…
Reference in a new issue