Skip to content

Commit c7d7ce1

Browse files
committed
minor corner case
1 parent 26b8ad2 commit c7d7ce1

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

ftplugin/python/ipy.vim

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -190,32 +190,34 @@ def update_subchannel_msgs(debug=False):
190190
vim.command("syn match Red /^Out\[[0-9]*\]\:/")
191191
b = vim.current.buffer
192192
for m in msgs:
193-
db.append(str(m).splitlines())
193+
#db.append(str(m).splitlines())
194+
s = ''
194195
if 'msg_type' not in m:
195196
# debug information
196197
#echo('skipping a message on sub_channel','WarningMsg')
197198
#echo(str(m))
198199
continue
199-
if m['msg_type'] == 'status':
200+
elif m['msg_type'] == 'status':
200201
continue
201-
if m['msg_type'] == 'stream':
202+
elif m['msg_type'] == 'stream':
202203
s = strip_color_escapes(m['content']['data'])
203-
if m['msg_type'] == 'pyout':
204+
elif m['msg_type'] == 'pyout':
204205
s = "Out[%d]: " % m['content']['execution_count']
205206
s += m['content']['data']['text/plain']
206-
if m['msg_type'] == 'pyin':
207+
elif m['msg_type'] == 'pyin':
207208
# TODO: the next line allows us to resend a line to ipython if
208209
# %doctest_mode is on. In the future, IPython will send the
209210
# execution_count on subchannel, so this will need to be updated
210211
# once that happens
211212
s = "\nIn [00]: "
212213
s += m['content']['code'].strip()
213-
if m['msg_type'] == 'pyerr':
214+
elif m['msg_type'] == 'pyerr':
214215
c = m['content']
215216
s = "\n".join(map(strip_color_escapes,c['traceback']))
216217
s += c['ename'] + ":" + c['evalue']
217-
if s.find('\n')==-1:
218-
# somewhat ugly unicode workaround from http://vim.1045645.n5.nabble.com/Limitations-of-vim-python-interface-with-respect-to-character-encodings-td1223881.html
218+
if s.find('\n') == -1:
219+
# somewhat ugly unicode workaround from
220+
# http://vim.1045645.n5.nabble.com/Limitations-of-vim-python-interface-with-respect-to-character-encodings-td1223881.html
219221
if isinstance(s,unicode):
220222
s=s.encode(vim_encoding)
221223
b.append(s)

0 commit comments

Comments
 (0)