From 525510e53dcbd034f952c1aa632b73722fb50c35 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 19 Sep 2017 11:14:15 +0530 Subject: [PATCH] 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) --- src/calibre/gui2/tweak_book/editor/snippets.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/calibre/gui2/tweak_book/editor/snippets.py b/src/calibre/gui2/tweak_book/editor/snippets.py index e014202613..da4bd07687 100644 --- a/src/calibre/gui2/tweak_book/editor/snippets.py +++ b/src/calibre/gui2/tweak_book/editor/snippets.py @@ -421,6 +421,7 @@ class SnippetManager(QObject): if snip is None: error_dialog(self.parent(), _('No snippet found'), _( 'No matching snippet was found'), show=True) + self.last_selected_text = self.last_selected_text or lst return True template = expand_template(editor, trigger, snip['template']) if template.has_tab_stops: