mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2025-02-21 02:55:37 -08:00
refactor: remove csv from codepoint processing
This commit is contained in:
parent
d05737a8e8
commit
0674681fc8
|
@ -2,9 +2,10 @@ package engine
|
|||
|
||||
import (
|
||||
"context"
|
||||
"encoding/csv"
|
||||
"io"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/jandedobbeleer/oh-my-posh/src/platform"
|
||||
|
@ -30,23 +31,29 @@ func getGlyphCodePoints() (codePoints, error) {
|
|||
|
||||
defer response.Body.Close()
|
||||
|
||||
lines, err := csv.NewReader(response.Body).ReadAll()
|
||||
bytes, err := io.ReadAll(response.Body)
|
||||
if err != nil {
|
||||
return codePoints, err
|
||||
}
|
||||
|
||||
lines := strings.Split(string(bytes), "\n")
|
||||
|
||||
for _, line := range lines {
|
||||
if len(line) < 2 {
|
||||
fields := strings.Split(line, ",")
|
||||
if len(fields) < 2 {
|
||||
continue
|
||||
}
|
||||
oldGlyph, err := strconv.ParseUint(line[0], 16, 32)
|
||||
|
||||
oldGlyph, err := strconv.ParseUint(fields[0], 16, 32)
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
newGlyph, err := strconv.ParseUint(line[1], 16, 32)
|
||||
|
||||
newGlyph, err := strconv.ParseUint(fields[1], 16, 32)
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
|
||||
codePoints[oldGlyph] = newGlyph
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue