mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Edit book: Remove matching tag: Fix incorrect removal if the remove matching function is triggered in rapid succession
This commit is contained in:
parent
7cb5118aba
commit
7f255f141d
@ -352,9 +352,12 @@ class Smarts(NullSmarts):
|
||||
|
||||
def remove_tag(self, editor):
|
||||
editor.highlighter.join()
|
||||
if not self.last_matched_closing_tag and not self.last_matched_tag:
|
||||
return
|
||||
c = editor.textCursor()
|
||||
c.beginEditBlock()
|
||||
|
||||
def erase_tag(tag):
|
||||
c = editor.textCursor()
|
||||
c.setPosition(tag.start_block.position() + tag.start_offset)
|
||||
c.setPosition(tag.end_block.position() + tag.end_offset + 1, c.KeepAnchor)
|
||||
c.removeSelectedText()
|
||||
@ -363,6 +366,8 @@ class Smarts(NullSmarts):
|
||||
erase_tag(self.last_matched_closing_tag)
|
||||
if self.last_matched_tag:
|
||||
erase_tag(self.last_matched_tag)
|
||||
c.endEditBlock()
|
||||
self.last_matched_tag = self.last_matched_closing_tag = None
|
||||
|
||||
def rename_block_tag(self, editor, new_name):
|
||||
editor.highlighter.join()
|
||||
|
Loading…
x
Reference in New Issue
Block a user