Skip to content

Commit b92c982

Browse files
committed
1 parent 43ad3fd commit b92c982

File tree

3 files changed

+17
-5
lines changed

3 files changed

+17
-5
lines changed

Changelog.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ Changelog
33

44
* Get fold's expression symbol from &fillchars;
55
* Fixed error when setting g:pymode_breakpoint_cmd (expobrain);
6+
* Fixed code running;
67

78

89
## 2013-12-04 0.7.8b

autoload/pymode/tools/loclist.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ fun! g:PymodeLocList.show() "{{{
7070
lclose
7171
else
7272
let num = winnr()
73-
execute "lopen " . g:pymode_quickfix_maxheight
73+
lopen
7474
execute max([min([line("$"), g:pymode_quickfix_maxheight]), g:pymode_quickfix_minheight]) . "wincmd _"
7575
if num != winnr()
7676
call setwinvar(winnr(), 'quickfix_title', self._title . ' <' . self._name . '>')

pymode/run.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,25 @@
88
import sys
99

1010
from .environment import env
11+
from re import compile as re
12+
13+
14+
encoding = re(r'#[^\w]+coding:\s+utf.*$')
1115

1216

1317
def run_code():
14-
""" Run python code in current buffer. """
18+
""" Run python code in current buffer.
19+
20+
:returns: None
21+
22+
"""
1523

1624
errors, err = [], ''
1725
line1, line2 = env.var('a:line1'), env.var('a:line2')
1826
lines = __prepare_lines(line1, line2)
27+
for ix in (0, 1):
28+
if encoding.match(lines[ix]):
29+
lines.pop(ix)
1930

2031
context = dict(
2132
__name__='__main__', input=env.user_input, raw_input=env.user_input)
@@ -42,14 +53,14 @@ def run_code():
4253
else:
4354
err = sys.stderr.getvalue()
4455

45-
output = sys.stdout.getvalue().strip()
46-
output = env.prepare_value(output)
56+
output = sys.stdout.getvalue()
57+
output = env.prepare_value(output, dumps=False)
4758
sys.stdout, sys.stderr = stdout_, stderr_
4859

4960
errors += [er for er in err.splitlines() if er and "<string>" not in er]
5061

5162
env.let('l:traceback', errors[2:])
52-
env.let('l:output', [s for s in output.split('\n') if s])
63+
env.let('l:output', [s for s in output.split('\n')])
5364

5465

5566
def __prepare_lines(line1, line2):

0 commit comments

Comments
 (0)