all repos — honk @ c1d01a3cd3718106b189b308a98952d7fa4c4348

my fork of honk

only need to dupe string for zalgo if zerowidth present
Ted Unangst tedu@tedunangst.com
Thu, 25 Apr 2019 10:59:57 -0400
commit

c1d01a3cd3718106b189b308a98952d7fa4c4348

parent

063809a2812f1c0e3a5db97c1dc20db3b26d11d7

1 files changed, 20 insertions(+), 9 deletions(-)

jump to
M skulduggery.goskulduggery.go

@@ -70,19 +70,30 @@ }

return string(x) } s = re_alltheshitz.ReplaceAllStringFunc(s, fixer) - x := make([]byte, 0, len(s)) + zw := false for _, c := range s { if runewidth.RuneWidth(c) == 0 { - if zw { - continue + zw = true + break + } + } + if zw { + x := make([]byte, 0, len(s)) + zw = false + for _, c := range s { + if runewidth.RuneWidth(c) == 0 { + if zw { + continue + } + zw = true + } else { + zw = false } - zw = true - } else { - zw = false + q := string(c) + x = append(x, []byte(q)...) } - q := string(c) - x = append(x, []byte(q)...) + return string(x) } - return string(x) + return s }