mirror of
https://github.com/codex-storage/deluge.git
synced 2025-02-17 05:47:50 +00:00
Fix unicode support in console ui (#1307)
This commit is contained in:
parent
c06f905702
commit
81a837faed
@ -308,7 +308,7 @@ class Screen(CursesStdIO):
|
|||||||
if c == curses.KEY_ENTER or c == 10:
|
if c == curses.KEY_ENTER or c == 10:
|
||||||
if self.input:
|
if self.input:
|
||||||
self.add_line(">>> " + self.input)
|
self.add_line(">>> " + self.input)
|
||||||
self.command_parser(self.input)
|
self.command_parser(self.input.encode(self.encoding))
|
||||||
if len(self.input_history) == INPUT_HISTORY_SIZE:
|
if len(self.input_history) == INPUT_HISTORY_SIZE:
|
||||||
# Remove the oldest input history if the max history size
|
# Remove the oldest input history if the max history size
|
||||||
# is reached.
|
# is reached.
|
||||||
@ -404,20 +404,12 @@ class Screen(CursesStdIO):
|
|||||||
if c > 31 and c < 256:
|
if c > 31 and c < 256:
|
||||||
# Emulate getwch
|
# Emulate getwch
|
||||||
stroke = chr(c)
|
stroke = chr(c)
|
||||||
|
uchar = ""
|
||||||
uchar = None
|
while not uchar:
|
||||||
|
|
||||||
while 1:
|
|
||||||
try:
|
try:
|
||||||
uchar = stroke.decode(self.encoding)
|
uchar = stroke.decode(self.encoding)
|
||||||
except UnicodeDecodeError:
|
except UnicodeDecodeError:
|
||||||
pass
|
|
||||||
|
|
||||||
c = self.stdscr.getch()
|
c = self.stdscr.getch()
|
||||||
|
|
||||||
if c == -1:
|
|
||||||
break
|
|
||||||
|
|
||||||
stroke += chr(c)
|
stroke += chr(c)
|
||||||
|
|
||||||
if uchar:
|
if uchar:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user