home
·
contact
·
privacy
projects
/
stable_plom
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
f3722f1
)
Browser: In by_1st view's prompt summaries, ellipsize prompt into two parts.
master
author
Christian Heller
<c.heller@plomlompom.de>
Wed, 13 Nov 2024 02:32:59 +0000
(
03:32
+0100)
committer
Christian Heller
<c.heller@plomlompom.de>
Wed, 13 Nov 2024 02:32:59 +0000
(
03:32
+0100)
browser.py
patch
|
blob
|
history
diff --git
a/browser.py
b/browser.py
index 81ec8870d69555a08bd48d18bda3eb9d8883338d..89eabadfa7c5b80b14c2405b36c5909e122a82f3 100755
(executable)
--- a/
browser.py
+++ b/
browser.py
@@
-854,10
+854,21
@@
class Gallery:
if suffix:
for i, p in enumerate(cores):
cores[i] = p[:-len(suffix)]
if suffix:
for i, p in enumerate(cores):
cores[i] = p[:-len(suffix)]
+ longest_total = ''
+ for i in range(len(cores[0])):
+ temp_longest = find_longest_equal(cores, j=i, matcher='in')
+ if len(temp_longest) > len(longest_total):
+ longest_total = temp_longest
+ middle = longest_total
for i, p in enumerate(prompts):
for i, p in enumerate(prompts):
+ remains = p[len(prefix):]
+ idx_middle = remains.index(middle)
+ second = remains[:idx_middle]
+ remains = remains[idx_middle + len(middle):]
+ first = remains[:-len(suffix)] if suffix else remains
pre_ell = '…' if prefix else ''
post_ell = '…' if suffix else ''
pre_ell = '…' if prefix else ''
post_ell = '…' if suffix else ''
- prompts_diff[p] = f'{pre_ell}{
cores[i]
}{post_ell}'
+ prompts_diff[p] = f'{pre_ell}{
first}…{second
}{post_ell}'
return prompts_diff
basic_items_attrs = {}
return prompts_diff
basic_items_attrs = {}