mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-10 16:48:31 +02:00
Fix duplicate text in multiple tag search by removing selective coloring on searched tags only #926 (#948)
This commit is contained in:
parent
1f1a57db89
commit
fcf42e3233
2 changed files with 13 additions and 9 deletions
|
@ -108,3 +108,14 @@ Feature: Tagging
|
||||||
| As alway's he shared his latest @idea on how to rule the world with me.
|
| As alway's he shared his latest @idea on how to rule the world with me.
|
||||||
| inst
|
| inst
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
Scenario: Searching a journal for multiple tags with -and should display entries with those tags.
|
||||||
|
Given we use the config "tags.yaml"
|
||||||
|
When we run "jrnl -and @idea @journal"
|
||||||
|
Then the output should be
|
||||||
|
"""
|
||||||
|
2013-04-09 15:39 I have an @idea:
|
||||||
|
| (1) write a command line @journal software
|
||||||
|
| (2) ???
|
||||||
|
| (3) PROFIT!
|
||||||
|
"""
|
||||||
|
|
|
@ -225,14 +225,7 @@ def highlight_tags_with_background_color(entry, text, color, is_title=False):
|
||||||
|
|
||||||
config = entry.journal.config
|
config = entry.journal.config
|
||||||
if config["highlight"]: # highlight tags
|
if config["highlight"]: # highlight tags
|
||||||
if entry.journal.search_tags:
|
text_fragments = re.split(entry.tag_regex(config["tagsymbols"]), text)
|
||||||
text_fragments = []
|
|
||||||
for tag in entry.journal.search_tags:
|
|
||||||
text_fragments.extend(
|
|
||||||
re.split(re.compile(f"({re.escape(tag)})", re.IGNORECASE), text)
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
text_fragments = re.split(entry.tag_regex(config["tagsymbols"]), text)
|
|
||||||
|
|
||||||
# Colorizing tags inside of other blocks of text
|
# Colorizing tags inside of other blocks of text
|
||||||
final_text = ""
|
final_text = ""
|
||||||
|
|
Loading…
Add table
Reference in a new issue