From 3eb87c29f9c13b5480f6d41353e1cef8f74c30c7 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 27 Jul 2014 06:53:45 +0530 Subject: [PATCH] Edit Book: Fix cursor positioning not working when creating a new file from a template --- src/calibre/gui2/tweak_book/boss.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/calibre/gui2/tweak_book/boss.py b/src/calibre/gui2/tweak_book/boss.py index a2b145944b..b72fc511c5 100644 --- a/src/calibre/gui2/tweak_book/boss.py +++ b/src/calibre/gui2/tweak_book/boss.py @@ -383,10 +383,9 @@ class Boss(QObject): def do_add_file(self, file_name, data, using_template=False, edit_file=False): self.add_savepoint(_('Before: Add file %s') % self.gui.elided_text(file_name)) c = current_container() - if using_template: - data = data.replace(b'%CURSOR%', b'') + adata = data.replace(b'%CURSOR%', b'') if using_template else data try: - c.add_file(file_name, data) + c.add_file(file_name, adata) except: self.rewind_savepoint() raise