summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Garland <johnnybg+deluge@gmail.com>2010-06-07 19:49:09 +1000
committerJohn Garland <johnnybg+deluge@gmail.com>2010-06-07 20:18:35 +1000
commit7fb3c3c04cf683ae19fa2a2dc1b4453845249bc6 (patch)
treef0b0212e16a5f8e964131d2e8fdc976ad19cacba
parent19c27ee8c5448ad8bfa9db7d3ed5e109254e7711 (diff)
downloaddeluge-7fb3c3c04cf683ae19fa2a2dc1b4453845249bc6.tar.gz
deluge-7fb3c3c04cf683ae19fa2a2dc1b4453845249bc6.tar.bz2
deluge-7fb3c3c04cf683ae19fa2a2dc1b4453845249bc6.zip
Fix unicode support in console ui (#1307)
-rw-r--r--ChangeLog4
-rw-r--r--deluge/ui/console/screen.py20
2 files changed, 10 insertions, 14 deletions
diff --git a/ChangeLog b/ChangeLog
index 21b4896b5..4b119be19 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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) ===
==== Core ====
* Implement #1063 option to delete torrent file copy on torrent removal - patch from Ghent
diff --git a/deluge/ui/console/screen.py b/deluge/ui/console/screen.py
index a8f7f9a57..ad0da738f 100644
--- a/deluge/ui/console/screen.py
+++ b/deluge/ui/console/screen.py
@@ -308,7 +308,7 @@ class Screen(CursesStdIO):
if c == curses.KEY_ENTER or c == 10:
if 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:
# Remove the oldest input history if the max history size
# is reached.
@@ -404,21 +404,13 @@ class Screen(CursesStdIO):
if c > 31 and c < 256:
# Emulate getwch
stroke = chr(c)
-
- uchar = None
-
- while 1:
+ uchar = ""
+ while not uchar:
try:
uchar = stroke.decode(self.encoding)
except UnicodeDecodeError:
- pass
-
- c = self.stdscr.getch()
-
- if c == -1:
- break
-
- stroke += chr(c)
+ c = self.stdscr.getch()
+ stroke += chr(c)
if uchar:
if self.input_cursor == len(self.input):
@@ -426,7 +418,7 @@ class Screen(CursesStdIO):
else:
# Insert into string
self.input = self.input[:self.input_cursor] + uchar + self.input[self.input_cursor:]
-
+
# Move the cursor forward
self.input_cursor += 1