From 25fdaa735bdb0a0a6cdc268fa53e4bd04222b0f8 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 27 Sep 2023 14:03:43 +0530 Subject: [PATCH] Fix display of all notes results --- src/calibre/db/notes/connect.py | 4 ++-- src/calibre/gui2/library/notes.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/calibre/db/notes/connect.py b/src/calibre/db/notes/connect.py index 5f8bafe581..abd5a0c880 100644 --- a/src/calibre/db/notes/connect.py +++ b/src/calibre/db/notes/connect.py @@ -371,10 +371,10 @@ class Notes: if snippet_size is None: snippet_size = 64 char_size = snippet_size * 8 - query = 'SELECT {0}.id, {0}.colname, {0}.item, substr({0}.searchable_text, 9, {1}) FROM {0} '.format('notes', char_size) + query = 'SELECT {0}.id, {0}.colname, {0}.item, substr({0}.searchable_text, 0, {1}) FROM {0} '.format('notes', char_size) if restrict_to_fields: query += ' WHERE notes_db.notes.colname IN ({})'.format(','.join(repeat('?', len(restrict_to_fields)))) - query += ' ORDER BY ctime DESC' + query += ' ORDER BY mtime DESC' if limit is not None: query += f' LIMIT {limit}' for record in conn.execute(query, tuple(restrict_to_fields)): diff --git a/src/calibre/gui2/library/notes.py b/src/calibre/gui2/library/notes.py index 6d29b313c9..b48c2230b1 100644 --- a/src/calibre/gui2/library/notes.py +++ b/src/calibre/gui2/library/notes.py @@ -24,7 +24,7 @@ def current_db() -> Cache: class NotesResultsDelegate(ResultsDelegate): - add_ellipsis = False + add_ellipsis = True emphasize_text = False def result_data(self, result):