Handle no mark match better

This commit is contained in:
Kovid Goyal 2020-12-07 15:23:52 +05:30
parent 4f35428ff3
commit 464c0a4f1a
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -162,7 +162,9 @@ def select_tts_mark(idx_in_flat_text):
r = /\w+/g r = /\w+/g
r.lastIndex = idx_in_flat_text r.lastIndex = idx_in_flat_text
match = v'r.exec(cache.text_map.flat_text)' match = v'r.exec(cache.text_map.flat_text)'
word_length = match[0]?.length or 5 word_length = 5
if match:
word_length = match[0]?.length or 5
match = get_occurrence_data(cache.text_map.node_list, idx_in_flat_text, idx_in_flat_text + word_length) match = get_occurrence_data(cache.text_map.node_list, idx_in_flat_text, idx_in_flat_text + word_length)
if not match: if not match:
return False return False