fix type error
I moved the location of the check for an overflowing index to avoid a type error that was revealed by mypy. I also think this is a better place to put it from a code standpoint in general...
This commit is contained in:
parent
85afda8832
commit
89c62377da
@ -175,7 +175,7 @@ class Table:
|
|||||||
self.codepoints = codepoints
|
self.codepoints = codepoints
|
||||||
self.mode = mode
|
self.mode = mode
|
||||||
self.layout_dirty = True
|
self.layout_dirty = True
|
||||||
self.current_idx = current_idx
|
self.current_idx = current_idx if current_idx < len(codepoints) else 0
|
||||||
|
|
||||||
def codepoint_at_hint(self, hint: str) -> int:
|
def codepoint_at_hint(self, hint: str) -> int:
|
||||||
return self.codepoints[decode_hint(hint)]
|
return self.codepoints[decode_hint(hint)]
|
||||||
@ -330,7 +330,7 @@ class UnicodeInput(Handler):
|
|||||||
codepoints = codepoints_matching_search(tuple(words))
|
codepoints = codepoints_matching_search(tuple(words))
|
||||||
if q != self.last_updated_code_point_at:
|
if q != self.last_updated_code_point_at:
|
||||||
self.last_updated_code_point_at = q
|
self.last_updated_code_point_at = q
|
||||||
self.table.set_codepoints(codepoints or [], self.mode, iindex_word if iindex_word < len(codepoints) else 0)
|
self.table.set_codepoints(codepoints or [], self.mode, iindex_word)
|
||||||
|
|
||||||
def update_current_char(self) -> None:
|
def update_current_char(self) -> None:
|
||||||
self.update_codepoints()
|
self.update_codepoints()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user