perf: use sed for colour removals
This has a notable change of performance.
This commit is contained in:
parent
1bf2281912
commit
cf17522d50
1 changed files with 1 additions and 1 deletions
2
neofetch
2
neofetch
|
@ -5152,7 +5152,7 @@ print_ascii() {
|
||||||
strip_escape_codes "${line}" line
|
strip_escape_codes "${line}" line
|
||||||
# Use patterns to replace color codes that the above line did not catch
|
# Use patterns to replace color codes that the above line did not catch
|
||||||
line=${line//\\033\[*([0-9;])[JKmsu]/}
|
line=${line//\\033\[*([0-9;])[JKmsu]/}
|
||||||
line=${line//\[*([0-9;])[JKmsu]/}
|
line="$(printf %b "$line" | sed -E 's/'"$(printf %b '\x1B')"'\[*[0-9;]+[JKmsu]//g')"
|
||||||
((++lines,${#line}>ascii_len)) && ascii_len="${#line}"
|
((++lines,${#line}>ascii_len)) && ascii_len="${#line}"
|
||||||
done <<< "${ascii_data//\$\{??\}}"
|
done <<< "${ascii_data//\$\{??\}}"
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue