Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitce87975

Browse files
committed
Fix encoding bug
1 parentad7a3b3 commitce87975

File tree

5 files changed

+20
-6
lines changed

5 files changed

+20
-6
lines changed

‎AUTHORS‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ Contributors:
2323
* Lowe Thiderman (thiderman);
2424
* Martin Brochhaus (mbrochh);
2525
* Matthew Moses (mlmoses);
26+
* Mel Boyce (syngin)
2627
* Mohammed (mbadran);
2728
* Naoya Inada (naoina);
2829
* Pedro Algarvio (s0undt3ch);

‎Makefile‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ clean:
1111
# Temporary disable rope tests on Travis
1212
.PHONY: travis
1313
travis:
14-
rm -rf t/rope.vim
1514
raketest
1615

1716
.PHONY: test

‎pymode/environment.py‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,11 @@ def var(self, name, to_bool=False):
7777
returnvalue
7878

7979
defmessage(self,msg,history=False):
80-
""" Show message to user. """
80+
""" Show message to user.
81+
82+
:return: :None
83+
84+
"""
8185

8286
ifhistory:
8387
returnvim.command('echom "%s"'%str(msg))
@@ -188,14 +192,16 @@ def let(self, name, value):
188192
self.debug(cmd)
189193
vim.command(cmd)
190194

191-
defprepare_value(self,value):
195+
defprepare_value(self,value,dumps=True):
192196
""" Decode bstr to vim encoding.
193197
194198
:return unicode string:
195199
196200
"""
197201

198-
value=json.dumps(value)
202+
ifdumps:
203+
value=json.dumps(value)
204+
199205
ifPY2:
200206
value=value.decode('utf-8').encode(self.options.get('encoding'))
201207

‎pymode/rope.py‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,9 @@ def complete(dot=False):
8585
s_offset=codeassist.starting_offset(source,offset)
8686
p_prefix=prefix[offset-s_offset:]
8787
line=env.lines[row-1]
88-
env.curbuf[row-1]=line[:col]+p_prefix+line[col:]# noqa
88+
cline=line[:col]+p_prefix+line[col:]
89+
ifcline!=line:
90+
env.curbuf[row-1]=env.prepare_value(cline,dumps=False)
8991
env.current.window.cursor= (row,col+len(p_prefix))
9092
env.run('complete',col-len(prefix)+len(p_prefix)+1,proposals)
9193
returnTrue
@@ -887,7 +889,8 @@ def _insert_import(name, module, ctx):
887889
source,_=env.get_offset_params()
888890
lineno=ctx.importer.find_insertion_line(source)
889891
line='from %s import %s'% (module,name)
890-
env.curbuf[lineno-1:lineno-1]= [line]
892+
env.curbuf[lineno-1:lineno-1]= [
893+
env.prepare_value(line,dumps=False)]
891894
returnTrue
892895

893896
pyobject=ctx.project.pycore.resource_to_pyobject(ctx.resource)

‎t/rope.vim‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ describe 'pymode-plugin'
1717
end
1818

1919
it'pymode rope auto open project in current working directory'
20+
21+
if$TRAVIS!=""
22+
SKIP'Travis fails on this test'
23+
endif
24+
2025
let project_path=getcwd() .'/.ropeproject'
2126
Expectisdirectory(project_path)==0
2227
normal oimporX

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp