E-book viewer: The quick highlight button should replace the style of an existing highlight, when one is selected. Fixes #1926518 [[Viewer] Quick highlighting a already highlighted text should replace the original highlighting](https://bugs.launchpad.net/calibre/+bug/1926518)

This commit is contained in:
Kovid Goyal 2021-04-29 06:49:03 +05:30
parent f0f7256e7b
commit 1471322f49
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -1027,12 +1027,16 @@ class SelectionBar:
cs = self.view.currently_showing.selection
if cs.text:
if cs.annot_id:
self.create_highlight()
am = self.annotations_manager
self.current_notes = am.notes_for_highlight(cs.annot_id) or ''
self.send_message(
'apply-highlight', style=self.current_highlight_style.style, uuid=short_uuid(), existing=cs.annot_id, has_notes=v'!!self.current_notes'
)
else:
self.current_notes = ''
self.send_message('apply-highlight', style=self.current_highlight_style.style, uuid=short_uuid(), has_notes=False)
self.state = WAITING
self.update_position()
self.state = WAITING
self.update_position()
def quick_highlight_with_style(self, hs):
self.current_highlight_style = hs