Fix unicode support in console ui (#1307)
This commit is contained in:
parent
19c27ee8c5
commit
7fb3c3c04c
|
@ -1,3 +1,7 @@
|
||||||
|
=== Deluge 1.3.0-rc2 (In Development) ===
|
||||||
|
==== ConsoleUI ====
|
||||||
|
* #1307: Fix not being able to add torrents
|
||||||
|
|
||||||
=== Deluge 1.3.0-rc1 (08 May 2010) ===
|
=== Deluge 1.3.0-rc1 (08 May 2010) ===
|
||||||
==== Core ====
|
==== Core ====
|
||||||
* Implement #1063 option to delete torrent file copy on torrent removal - patch from Ghent
|
* Implement #1063 option to delete torrent file copy on torrent removal - patch from Ghent
|
||||||
|
|
|
@ -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,21 +404,13 @@ 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()
|
||||||
|
stroke += chr(c)
|
||||||
c = self.stdscr.getch()
|
|
||||||
|
|
||||||
if c == -1:
|
|
||||||
break
|
|
||||||
|
|
||||||
stroke += chr(c)
|
|
||||||
|
|
||||||
if uchar:
|
if uchar:
|
||||||
if self.input_cursor == len(self.input):
|
if self.input_cursor == len(self.input):
|
||||||
|
|
Loading…
Reference in New Issue