Skip to content

Commit

Permalink
Merge pull request #8 from Garulf/feat-titlehighlightdata
Browse files Browse the repository at this point in the history
Feature: Add TitleHighlightData field to Result
  • Loading branch information
Garulf authored Jul 1, 2024
2 parents 390b759 + d633549 commit 02d1d18
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions pyflowlauncher/result.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class Result:
AutoCompleteText: Optional[str] = None
RoundedIcon: bool = False
Preview: Optional[PreviewInfo] = None
TitleHighlightData: Optional[List[int]] = None

def as_dict(self) -> Dict[str, Any]:
return self.__dict__
Expand Down
1 change: 1 addition & 0 deletions pyflowlauncher/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@ def score_results(
query_search_precision=score_cutoff
)
if match.matched or (match_on_empty_query and not query):
result.TitleHighlightData = match.index_list
result.Score = match.score
yield result
2 changes: 2 additions & 0 deletions tests/test_result.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ def test_asdict():
Title="Test",
SubTitle="Test",
IcoPath="Test.png",
TitleHighlightData=[0],
ContextData=["Test"],
Glyph={"Glyph": "Test", "FontFamily": "Test"},
CopyText="Test",
Expand All @@ -27,6 +28,7 @@ def test_asdict():
"Title": "Test",
"SubTitle": "Test",
"IcoPath": "Test.png",
"TitleHighlightData": [0],
"Score": 0,
"JsonRPCAction": {
"Method": "Test",
Expand Down

0 comments on commit 02d1d18

Please sign in to comment.