File tree Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -84,24 +84,31 @@ def message(msg, history=False):
84
84
85
85
return vim .command ('call pymode#wide_message("%s")' % str (msg ))
86
86
87
- def user_input (self , msg , default = '' ):
87
+ def user_input (self , msg = '' , default = '' ):
88
88
"""Return user input or default.
89
89
90
90
:return str:
91
91
92
92
"""
93
- msg = '%s %s ' % (self .prefix , msg )
93
+ prompt = []
94
+ prompt .append (str (self .prefix .strip ()))
95
+ prompt .append (str (msg ).strip ())
94
96
95
97
if default != '' :
96
- msg += '[%s] ' % default
98
+ prompt .append ('[%s]' % default )
99
+
100
+ prompt .append ('> ' )
101
+ prompt = ' ' .join ([s for s in prompt if s ])
102
+
103
+ vim .command ('echohl Debug' )
97
104
98
105
try :
99
- vim .command ('echohl Debug' )
100
- input_str = vim .eval ('input("%s> ")' % msg )
101
- vim .command ('echohl none' )
106
+ input_str = vim .eval ('input(%r)' % (prompt ,))
102
107
except KeyboardInterrupt :
103
108
input_str = ''
104
109
110
+ vim .command ('echohl none' )
111
+
105
112
return input_str or default
106
113
107
114
def user_confirm (self , msg , yes = False ):
You can’t perform that action at this time.
0 commit comments