mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 18:54:09 -04:00
Edit Book File List: Fix pre-selection of filename when renaming a file in the root
This commit is contained in:
parent
038630f669
commit
eb18b57463
@ -99,7 +99,9 @@ class ItemDelegate(QStyledItemDelegate): # {{{
|
|||||||
editor.setText(name)
|
editor.setText(name)
|
||||||
ext_pos = name.rfind('.')
|
ext_pos = name.rfind('.')
|
||||||
slash_pos = name.rfind('/')
|
slash_pos = name.rfind('/')
|
||||||
if ext_pos > -1 and slash_pos > -1 and ext_pos > slash_pos + 1:
|
if slash_pos == -1 and ext_pos > 0:
|
||||||
|
editor.setSelection(0, ext_pos)
|
||||||
|
elif ext_pos > -1 and slash_pos > -1 and ext_pos > slash_pos + 1:
|
||||||
editor.setSelection(slash_pos+1, ext_pos - slash_pos - 1)
|
editor.setSelection(slash_pos+1, ext_pos - slash_pos - 1)
|
||||||
else:
|
else:
|
||||||
editor.selectAll()
|
editor.selectAll()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user