mirror of
https://github.com/dylanaraps/pywal.git
synced 2024-11-26 01:43:15 +01:00
colors: Add error handling to reload
This commit is contained in:
parent
b684e1604e
commit
0a64877b1e
19
wal
19
wal
@ -498,17 +498,20 @@ def read_file(input_file):
|
|||||||
|
|
||||||
def reload_colors(vte):
|
def reload_colors(vte):
|
||||||
"""Reload colors."""
|
"""Reload colors."""
|
||||||
with open(CACHE_DIR / "sequences") as file:
|
sequence_file = pathlib.Path(CACHE_DIR / "sequences")
|
||||||
sequences = file.read()
|
|
||||||
|
|
||||||
# If vte mode was used, remove the problem sequence.
|
if sequence_file.is_file():
|
||||||
if vte:
|
with open(sequence_file, "r") as file:
|
||||||
sequences = re.sub(r"\]708;\#.{6}", "", sequences)
|
sequences = file.read()
|
||||||
|
|
||||||
# Decode the string.
|
# If vte mode was used, remove the problem sequence.
|
||||||
sequences = bytes(sequences, "utf-8").decode("unicode_escape")
|
if vte:
|
||||||
|
sequences = re.sub(r"\]708;\#.{6}", "", sequences)
|
||||||
|
|
||||||
|
# Decode the string.
|
||||||
|
sequences = bytes(sequences, "utf-8").decode("unicode_escape")
|
||||||
|
print(sequences, end="")
|
||||||
|
|
||||||
print(sequences, end="")
|
|
||||||
quit()
|
quit()
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user