mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 10:44:09 -04:00
Edit book: Fix searching for non-BMP unicode characters highlighting only half the character
This commit is contained in:
parent
181dc063df
commit
745dc0c72c
@ -35,7 +35,7 @@ from calibre.gui2.tweak_book.editor.themes import (
|
|||||||
from calibre.gui2.tweak_book.widgets import PARAGRAPH_SEPARATOR, PlainTextEdit
|
from calibre.gui2.tweak_book.widgets import PARAGRAPH_SEPARATOR, PlainTextEdit
|
||||||
from calibre.spell.break_iterator import index_of
|
from calibre.spell.break_iterator import index_of
|
||||||
from calibre.utils.icu import (
|
from calibre.utils.icu import (
|
||||||
capitalize, lower, safe_chr, string_length, swapcase, upper
|
capitalize, lower, safe_chr, string_length, swapcase, upper, utf16_length
|
||||||
)
|
)
|
||||||
from calibre.utils.img import image_to_data
|
from calibre.utils.img import image_to_data
|
||||||
from calibre.utils.titlecase import titlecase
|
from calibre.utils.titlecase import titlecase
|
||||||
@ -470,6 +470,7 @@ class TextEdit(PlainTextEdit):
|
|||||||
start, end = m.span()
|
start, end = m.span()
|
||||||
if start == end:
|
if start == end:
|
||||||
return False
|
return False
|
||||||
|
end = start + utf16_length(raw[start:end])
|
||||||
if wrap and not complete:
|
if wrap and not complete:
|
||||||
if reverse:
|
if reverse:
|
||||||
textpos = c.anchor()
|
textpos = c.anchor()
|
||||||
@ -515,6 +516,7 @@ class TextEdit(PlainTextEdit):
|
|||||||
start, end = m.span()
|
start, end = m.span()
|
||||||
if start == end:
|
if start == end:
|
||||||
return False
|
return False
|
||||||
|
end = start + utf16_length(raw[start:end])
|
||||||
if reverse:
|
if reverse:
|
||||||
start, end = end, start
|
start, end = end, start
|
||||||
c.clearSelection()
|
c.clearSelection()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user