From 350494d016e3dee48fd208084ec3a4918578635f Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 2 Oct 2019 12:36:05 +0530 Subject: [PATCH] After inserting a hyperlink restore text format allows typing after inserting the link in the previous text style --- src/calibre/gui2/comments_editor.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/calibre/gui2/comments_editor.py b/src/calibre/gui2/comments_editor.py index 680a9dfd99..4881f5c43c 100644 --- a/src/calibre/gui2/comments_editor.py +++ b/src/calibre/gui2/comments_editor.py @@ -576,6 +576,7 @@ class EditorWidget(QTextEdit, LineEditECM): # {{{ if is_image: c.insertImage(url) else: + oldfmt = QTextCharFormat(c.charFormat()) fmt = QTextCharFormat() fmt.setAnchor(True) fmt.setAnchorHref(url) @@ -590,6 +591,8 @@ class EditorWidget(QTextEdit, LineEditECM): # {{{ cur = self.textCursor() cur.setPosition(i), cur.setPosition(i + 1, c.KeepAnchor) cur.mergeCharFormat(fmt) + c.setPosition(c.position()) + c.setCharFormat(oldfmt) else: error_dialog(self, _('Invalid URL'),