mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix #2051207 [Editor: Insert Link produces two undo actions](https://bugs.launchpad.net/calibre/+bug/2051207)
This commit is contained in:
parent
d38baa022c
commit
39505b9d55
@ -480,6 +480,7 @@ class Smarts(NullSmarts):
|
||||
template = template.replace('_TEXT_', text or '')
|
||||
editor.highlighter.join()
|
||||
c = editor.textCursor()
|
||||
c.beginEditBlock()
|
||||
if c.hasSelection():
|
||||
c.insertText('') # delete any existing selected text
|
||||
ensure_not_within_tag_definition(c)
|
||||
@ -487,6 +488,7 @@ class Smarts(NullSmarts):
|
||||
c.insertText(template)
|
||||
c.setPosition(p) # ensure cursor is positioned inside the newly created tag
|
||||
editor.setTextCursor(c)
|
||||
c.endEditBlock()
|
||||
|
||||
def insert_tag(self, editor, name):
|
||||
m = re.match(r'[a-zA-Z0-9:-]+', name)
|
||||
|
Loading…
x
Reference in New Issue
Block a user