mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2024-12-28 20:39:40 -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 {
|
func escapeGlyphs(s string) string {
|
||||||
var builder strings.Builder
|
var builder strings.Builder
|
||||||
for _, r := range s {
|
for _, r := range s {
|
||||||
if r < 0x1000 {
|
// exclude regular characters and emoji
|
||||||
|
if r < 0x1000 || r > 0x10000 {
|
||||||
builder.WriteRune(r)
|
builder.WriteRune(r)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,6 +49,7 @@ func TestEscapeGlyphs(t *testing.T) {
|
||||||
{Input: "\ue0b4", Expected: "\\ue0b4"},
|
{Input: "\ue0b4", Expected: "\\ue0b4"},
|
||||||
{Input: "\ufd03", Expected: "\\ufd03"},
|
{Input: "\ufd03", Expected: "\\ufd03"},
|
||||||
{Input: "}", Expected: "}"},
|
{Input: "}", Expected: "}"},
|
||||||
|
{Input: "🏚", Expected: "🏚"},
|
||||||
}
|
}
|
||||||
for _, tc := range cases {
|
for _, tc := range cases {
|
||||||
assert.Equal(t, tc.Expected, escapeGlyphs(tc.Input), tc.Input)
|
assert.Equal(t, tc.Expected, escapeGlyphs(tc.Input), tc.Input)
|
||||||
|
|
Loading…
Reference in a new issue