mirror of
https://github.com/aljazceru/njump.git
synced 2025-12-18 06:44:22 +01:00
match numbers and letters on highlight.
This commit is contained in:
@@ -487,7 +487,7 @@ func shapeText(rawText []rune, fontSize int) (shaping.Output, []bool, []hlstate)
|
|||||||
case hlNormal:
|
case hlNormal:
|
||||||
if glyph.Codepoint == '#' &&
|
if glyph.Codepoint == '#' &&
|
||||||
len(buf.Info) > i+1 &&
|
len(buf.Info) > i+1 &&
|
||||||
unicode.In(buf.Info[i+1].Codepoint, unicode.Letter) {
|
unicode.In(buf.Info[i+1].Codepoint, unicode.Nl) {
|
||||||
hlState = hlHashtag
|
hlState = hlHashtag
|
||||||
} else if glyph.Codepoint == 'h' &&
|
} else if glyph.Codepoint == 'h' &&
|
||||||
len(buf.Info) > i+1 &&
|
len(buf.Info) > i+1 &&
|
||||||
@@ -509,7 +509,8 @@ func shapeText(rawText []rune, fontSize int) (shaping.Output, []bool, []hlstate)
|
|||||||
}
|
}
|
||||||
} else if glyph.Codepoint == '@' &&
|
} else if glyph.Codepoint == '@' &&
|
||||||
len(buf.Info) > i+1 &&
|
len(buf.Info) > i+1 &&
|
||||||
unicode.In(buf.Info[i+1].Codepoint, unicode.Letter) {
|
unicode.In(buf.Info[i+1].Codepoint,
|
||||||
|
unicode.Nl, unicode.Number) {
|
||||||
hlState = hlMention
|
hlState = hlMention
|
||||||
}
|
}
|
||||||
case hlLink:
|
case hlLink:
|
||||||
@@ -518,11 +519,11 @@ func shapeText(rawText []rune, fontSize int) (shaping.Output, []bool, []hlstate)
|
|||||||
hlState = hlNormal
|
hlState = hlNormal
|
||||||
}
|
}
|
||||||
case hlMention:
|
case hlMention:
|
||||||
if !unicode.In(glyph.Codepoint, unicode.Letter) {
|
if !unicode.In(glyph.Codepoint, unicode.Nl) {
|
||||||
hlState = hlNormal
|
hlState = hlNormal
|
||||||
}
|
}
|
||||||
case hlHashtag:
|
case hlHashtag:
|
||||||
if !unicode.In(glyph.Codepoint, unicode.Letter) {
|
if !unicode.In(glyph.Codepoint, unicode.Nl) {
|
||||||
hlState = hlNormal
|
hlState = hlNormal
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user