From 5875303a488c02e7010b1546f7fe0d6f3b61f82a Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 16 Jan 2024 21:16:54 +0530 Subject: [PATCH] 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. --- src/calibre/gui2/library/notes.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/calibre/gui2/library/notes.py b/src/calibre/gui2/library/notes.py index 34de2fcedb..877d7eacdc 100644 --- a/src/calibre/gui2/library/notes.py +++ b/src/calibre/gui2/library/notes.py @@ -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