Unicode input: Fix an error when searching for the string 'fir'
Fixes #1035
This commit is contained in:
@@ -9,6 +9,8 @@ Changelog
|
|||||||
- macOS: Fix kitty window not being rendered on macOS Mojave until the window is
|
- macOS: Fix kitty window not being rendered on macOS Mojave until the window is
|
||||||
moved or resized at least once (:iss:`887`)
|
moved or resized at least once (:iss:`887`)
|
||||||
|
|
||||||
|
- Unicode input: Fix an error when searching for the string 'fir' (:iss:`1035`)
|
||||||
|
|
||||||
|
|
||||||
0.12.2 [2018-09-24]
|
0.12.2 [2018-09-24]
|
||||||
------------------------------
|
------------------------------
|
||||||
|
|||||||
@@ -159,9 +159,12 @@ class Table:
|
|||||||
self.last_cols, self.last_rows = cols, rows
|
self.last_cols, self.last_rows = cols, rows
|
||||||
self.layout_dirty = False
|
self.layout_dirty = False
|
||||||
|
|
||||||
|
def safe_chr(codepoint):
|
||||||
|
return chr(codepoint).encode('utf-8', 'replace').decode('utf-8')
|
||||||
|
|
||||||
if self.mode is NAME:
|
if self.mode is NAME:
|
||||||
def as_parts(i, codepoint):
|
def as_parts(i, codepoint):
|
||||||
return encode_hint(i).ljust(idx_size), chr(codepoint), name(codepoint)
|
return encode_hint(i).ljust(idx_size), safe_chr(codepoint), name(codepoint)
|
||||||
|
|
||||||
def cell(i, idx, c, desc):
|
def cell(i, idx, c, desc):
|
||||||
is_current = i == self.current_idx
|
is_current = i == self.current_idx
|
||||||
@@ -181,7 +184,7 @@ class Table:
|
|||||||
|
|
||||||
else:
|
else:
|
||||||
def as_parts(i, codepoint):
|
def as_parts(i, codepoint):
|
||||||
return encode_hint(i).ljust(idx_size), chr(codepoint), ''
|
return encode_hint(i).ljust(idx_size), safe_chr(codepoint), ''
|
||||||
|
|
||||||
def cell(i, idx, c, desc):
|
def cell(i, idx, c, desc):
|
||||||
yield colored(idx, 'green') + ' '
|
yield colored(idx, 'green') + ' '
|
||||||
|
|||||||
Reference in New Issue
Block a user