make conversion work with non-ascii character maps

See: <https://go.dev/blog/strings>
Using standard range iteration writes the byte offset into `index` and not the character offset, thus failing to correctly index into the output map.
This commit is contained in:
RandomGuyWithoutY 2024-04-14 21:33:08 +02:00 committed by GitHub
parent d05a757c5e
commit 97aadef8a0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 1 deletions

View File

@ -72,9 +72,11 @@ func ConvertToAsciiChars(imgSet [][]AsciiPixel, negative, colored, grayscale, co
} else { } else {
chosenTable = map[int]string{} chosenTable = map[int]string{}
index := 0
for index, char := range customMap { for _, char := range customMap {
chosenTable[index] = string(char) chosenTable[index] = string(char)
index++
} }
} }