mirror of
git://github.com/kovidgoyal/calibre.git
synced 2025-12-19 18:34:57 +01:00
Edit Book: Fix Live CSS not working for self-closing tags/closing tags
This commit is contained in:
parent
384b6b924a
commit
33ec496462
1 changed files with 3 additions and 1 deletions
|
|
@ -395,9 +395,11 @@ def cursor_position_with_sourceline(self, cursor, for_position_sync=True):
|
|||
nblock, boundary = next_tag_boundary(block, offset, forward=False)
|
||||
if boundary is None:
|
||||
return None, None
|
||||
in_tag_definition = False
|
||||
if boundary.is_start:
|
||||
# We are inside a tag, use this tag
|
||||
start_block, start_offset = nblock, boundary.offset
|
||||
in_tag_definition = True
|
||||
else:
|
||||
start_block = None
|
||||
while start_block is None and block.isValid():
|
||||
|
|
@ -414,7 +416,7 @@ def cursor_position_with_sourceline(self, cursor, for_position_sync=True):
|
|||
ud = start_block.userData()
|
||||
if ud is None:
|
||||
return None, None
|
||||
if for_position_sync:
|
||||
if for_position_sync or in_tag_definition:
|
||||
return sourceline, [
|
||||
t.name for t in ud.tags if (t.is_start and not t.closing and t.offset <= start_offset)]
|
||||
# We discard self-closing as well as tags that are both opened and
|
||||
|
|
|
|||
Loading…
Reference in a new issue