Separate category value from notes in results list

Only works if there is no search or the match is close enough for the
result text to include the category value.
This commit is contained in:
Kovid Goyal 2024-01-16 21:16:54 +05:30
parent d4d45eb5b9
commit 5875303a48
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -34,7 +34,7 @@ class NotesResultsDelegate(ResultsDelegate):
def result_data(self, result):
if not isinstance(result, dict):
return None, None, None, None, None
full_text = result['text']
full_text = result['text'].replace('\n', ': ', 1)
parts = full_text.split('\x1d', 2)
before = after = ''
if len(parts) > 2:
@ -44,6 +44,8 @@ class NotesResultsDelegate(ResultsDelegate):
before, text = parts
else:
text = parts[0]
if len(parts) > 1 and before:
before = before.replace('\n', ': ', 1)
return False, before, text, after, False
@ -519,4 +521,5 @@ if __name__ == '__main__':
br = NotesBrowser()
br.exec()
del br
del app