Skip to content

Commit 60c638d

Browse files
committed
added branch develop to Travis CI build and solved gh issue python-mode#814 (on the folding jumping problem)
1 parent 9b61eab commit 60c638d

4 files changed

Lines changed: 25 additions & 8 deletions

File tree

.travis.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
# Deactivated.
2-
# This plugin needs a robust test suite.
1+
# Build vim from source with python3 support and execute tests.
32
branches:
43
only:
5-
# - develop
6-
- dev_imp_test
4+
- develop
75
before_install:
86
- export ORIGINAL_FOLDER=$PWD
97
- sudo apt install libncurses5-dev libgnome2-dev libgnomeui-dev libgtk2.0-dev libatk1.0-dev libbonoboui2-dev libcairo2-dev libx11-dev libxpm-dev libxt-dev python-dev python3-dev lua5.1 lua5.1-dev libperl-dev git

autoload/pymode/folding.vim

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ endfunction "}}}
4646

4747
fun! pymode#folding#expr(lnum) "{{{
4848

49-
return pymode#folding#foldcase(a:lnum)['foldlevel']
49+
let l:return_value = pymode#folding#foldcase(a:lnum)['foldlevel']
50+
51+
return l:return_value
5052

5153
endfunction "}}}
5254

@@ -138,9 +140,7 @@ fun! pymode#folding#foldcase(lnum) "{{{
138140
let line_block_start = s:BlockStart(a:lnum)
139141
let line_block_end = s:BlockEnd(a:lnum)
140142
let prev_line_block_start = s:BlockStart(a:lnum - 1)
141-
let save_cursor = getcurpos()
142143
if line !~ s:blank_regex
143-
call setpos('.', save_cursor)
144144
if line_block_start == prev_line_block_start
145145
\ || a:lnum - line_block_start == 1
146146
let l:foldcase = 'non blank line; first line of block or part of it'

ftplugin/python/pymode.vim

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,30 @@ endif
5454

5555
" Python folding
5656
if g:pymode_folding
57+
" On the folding problem.
58+
" =======================
59+
" What happens when your enter insert mode with fdm=expr:
60+
" TODO:
61+
"
62+
" What happens when your leave insert mode and trigger fdm=expr:
63+
" TODO:
5764

5865
setlocal foldmethod=expr
5966
setlocal foldexpr=pymode#folding#expr(v:lnum)
6067
setlocal foldtext=pymode#folding#text()
6168

69+
70+
au! pymode InsertEnter *.py setlocal foldmethod=manual
71+
au! pymode InsertLeave *.py let s:save_winview = winsaveview()
72+
73+
au pymode InsertLeave *.py let s:save_cursor = getcurpos()
74+
au pymode InsertLeave *.py set nofoldenable
75+
au pymode InsertLeave *.py setlocal foldmethod=expr
76+
au pymode InsertLeave *.py set foldenable
77+
au pymode InsertLeave *.py call winrestview(s:save_winview)
78+
au pymode InsertLeave *.py call setpos('.', s:save_cursor)
79+
au pymode InsertLeave *.py call winrestview(s:save_winview)
80+
6281
endif
6382

6483
" Remove unused whitespaces

readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
![](https://travis-ci.org/klen/python-mode.png?branch=develop)
1+
![](https://travis-ci.org/python-mode/python-mode.svg?branch=develop)
22

33
![](https://raw.github.com/python-mode/python-mode/develop/logo.png)
44
# Python-mode, a Python IDE for Vim

0 commit comments

Comments
 (0)