Editor snippets: Dont lose the last selected word when the user triggers a non-existent snippet. Fixes #1713244 [Typo in snippet trigger makes ebook editor forget the selection](https://bugs.launchpad.net/calibre/+bug/1713244)

This commit is contained in:
Kovid Goyal 2017-09-19 11:14:15 +05:30
parent 2b92691c68
commit 525510e53d
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -421,6 +421,7 @@ class SnippetManager(QObject):
if snip is None: if snip is None:
error_dialog(self.parent(), _('No snippet found'), _( error_dialog(self.parent(), _('No snippet found'), _(
'No matching snippet was found'), show=True) 'No matching snippet was found'), show=True)
self.last_selected_text = self.last_selected_text or lst
return True return True
template = expand_template(editor, trigger, snip['template']) template = expand_template(editor, trigger, snip['template'])
if template.has_tab_stops: if template.has_tab_stops: