File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -812,14 +812,20 @@ def prompt(self, more):
812
812
# XXX is this the right place?
813
813
self .rl_history .reset ()
814
814
# XXX what is s_hist?
815
+
816
+ # We need the caption to use unicode as urwid normalizes later
817
+ # input to be the same type, using ascii as encoding. If the
818
+ # caption is bytes this breaks typing non-ascii into bpython.
819
+ # Currently this decodes using ascii as I do not know where
820
+ # ps1 is getting loaded from. If anyone wants to make
821
+ # non-ascii prompts work feel free to fix this.
815
822
if not more :
816
- self .edit = BPythonEdit (self .config ,
817
- caption = ('prompt' , self .ps1 ))
823
+ caption = ('prompt' , self .ps1 .decode ('ascii' ))
818
824
self .stdout_hist += self .ps1
819
825
else :
820
- self .edit = BPythonEdit (self .config ,
821
- caption = ('prompt_more' , self .ps2 ))
826
+ caption = ('prompt_more' , self .ps2 .decode ('ascii' ))
822
827
self .stdout_hist += self .ps2
828
+ self .edit = BPythonEdit (self .config , caption = caption )
823
829
824
830
urwid .connect_signal (self .edit , 'change' , self .on_input_change )
825
831
urwid .connect_signal (self .edit , 'edit-pos-changed' ,
You can’t perform that action at this time.
0 commit comments