From 772febd578c3afe8701c3cc5788ea115f4d91c87 Mon Sep 17 00:00:00 2001
From: Kovid Goyal
Date: Thu, 9 Jun 2022 22:05:45 +0530
Subject: [PATCH] Limit max length of book info entries
---
src/calibre/gui2/fts/search.py | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/src/calibre/gui2/fts/search.py b/src/calibre/gui2/fts/search.py
index 644bdea81b..028a68cb39 100644
--- a/src/calibre/gui2/fts/search.py
+++ b/src/calibre/gui2/fts/search.py
@@ -501,11 +501,20 @@ class ResultDetails(QWidget):
self.do_layout()
def render_book_info(self, results):
+ t = results.title
+ if len(t) > 72:
+ t = t[:71] + '…'
text = f'{results.title}
'
- text += f'{authors_to_string(results.authors)}
'
+ au = results.authors
+ if len(au) > 3:
+ au = list(au[:3]) + ['…']
+ text += f'{authors_to_string(au)}
'
if results.series:
sidx = fmt_sidx(results.series_index or 0, use_roman=config['use_roman_numerals_for_series_number'])
- text += '' + _('{series_index} of {series}').format(series_index=sidx, series=results.series) + '
'
+ series = results.series
+ if len(series) > 60:
+ series = series[:59] + '…'
+ text += '' + _('{series_index} of {series}').format(series_index=sidx, series=series) + '
'
text += '
\xa0{0}\xa0\xa0\xa0 '.format(
_('Select'), '
' + _('Scroll to this book in the calibre library book list and select it.'))
text += '
\xa0{0}
'.format(