mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-17 03:28:31 +02:00
fix issues on namespace of 'colorama' variable
This commit is contained in:
parent
afb5c03389
commit
516b01bb18
2 changed files with 4 additions and 5 deletions
|
@ -168,11 +168,11 @@ class Journal(object):
|
|||
for tag in self.search_tags:
|
||||
tagre = re.compile(re.escape(tag), re.IGNORECASE)
|
||||
pp = re.sub(tagre,
|
||||
lambda match: util.colorize(match.group(0)),
|
||||
lambda match: util.colorize(match.group(0), colorama),
|
||||
pp, re.UNICODE)
|
||||
else:
|
||||
pp = re.sub(r"(?u)([{tags}]\w+)".format(tags=self.config['tagsymbols']),
|
||||
lambda match: util.colorize(match.group(0)),
|
||||
lambda match: util.colorize(match.group(0), colorama),
|
||||
pp)
|
||||
return pp
|
||||
|
||||
|
@ -435,4 +435,3 @@ class DayOne(Journal):
|
|||
self._deleted_entries = [e for e in self.entries if e.uuid not in edited_uuids]
|
||||
self.entries[:] = [e for e in self.entries if e.uuid in edited_uuids]
|
||||
return entries
|
||||
|
||||
|
|
|
@ -139,7 +139,7 @@ def get_text_from_editor(config, template=""):
|
|||
prompt('[Nothing saved to file]')
|
||||
return raw
|
||||
|
||||
def colorize(string):
|
||||
def colorize(string, colorama=None):
|
||||
"""Returns the string wrapped in cyan ANSI escape"""
|
||||
if os.name == "nt" and not colorama:
|
||||
return string
|
||||
|
|
Loading…
Add table
Reference in a new issue