Update runtime files
diff --git a/runtime/indent/python.vim b/runtime/indent/python.vim
index e53987a..f9236e6 100644
--- a/runtime/indent/python.vim
+++ b/runtime/indent/python.vim
@@ -28,6 +28,11 @@
let s:maxoff = 50 " maximum number of lines to look backwards for ()
+" See if the specified line is already user-dedented from the expected value.
+function s:Dedented(lnum, expected)
+ return indent(a:lnum) <= a:expected - shiftwidth()
+endfunction
+
function GetPythonIndent(lnum)
" If this line is explicitly joined: If the previous line was also joined,
@@ -158,12 +163,12 @@
" If the previous line was a stop-execution statement...
if getline(plnum) =~ '^\s*\(break\|continue\|raise\|return\|pass\)\>'
" See if the user has already dedented
- if indent(a:lnum) > indent(plnum) - shiftwidth()
- " If not, recommend one dedent
- return indent(plnum) - shiftwidth()
+ if s:Dedented(a:lnum, indent(plnum))
+ " If so, trust the user
+ return -1
endif
- " Otherwise, trust the user
- return -1
+ " If not, recommend one dedent
+ return indent(plnum) - shiftwidth()
endif
" If the current line begins with a keyword that lines up with "try"
@@ -191,7 +196,7 @@
endif
" Or the user has already dedented
- if indent(a:lnum) <= plindent - shiftwidth()
+ if s:Dedented(a:lnum, plindent)
return -1
endif
@@ -203,7 +208,12 @@
" + c)
" here
if parlnum > 0
- return plindent
+ " ...unless the user has already dedented
+ if s:Dedented(a:lnum, plindent)
+ return -1
+ else
+ return plindent
+ endif
endif
return -1