mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2024-12-26 19:39:39 -08:00
fix: do not escape emoji
This commit is contained in:
parent
bfca351796
commit
566240c0ed
|
@ -194,7 +194,8 @@ func (cfg *Config) write(destination string) {
|
|||
func escapeGlyphs(s string) string {
|
||||
var builder strings.Builder
|
||||
for _, r := range s {
|
||||
if r < 0x1000 {
|
||||
// exclude regular characters and emoji
|
||||
if r < 0x1000 || r > 0x10000 {
|
||||
builder.WriteRune(r)
|
||||
continue
|
||||
}
|
||||
|
|
|
@ -49,6 +49,7 @@ func TestEscapeGlyphs(t *testing.T) {
|
|||
{Input: "\ue0b4", Expected: "\\ue0b4"},
|
||||
{Input: "\ufd03", Expected: "\\ufd03"},
|
||||
{Input: "}", Expected: "}"},
|
||||
{Input: "🏚", Expected: "🏚"},
|
||||
}
|
||||
for _, tc := range cases {
|
||||
assert.Equal(t, tc.Expected, escapeGlyphs(tc.Input), tc.Input)
|
||||
|
|
Loading…
Reference in a new issue