Skip to content

Commit 599db67

Browse files
committed
Fix s:ExprCol() sometimes go into infinity loop when calculating indent
1 parent 39e332a commit 599db67

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

indent/javascript.vim

+2-1
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,8 @@ function s:ExprCol()
204204
return 1
205205
endif
206206
let bal = 0
207-
while s:SearchLoop('[{}?:]','bW',s:skip_expr)
207+
let lines = line('.')
208+
while s:SearchLoop('[{}?:]','bW',s:skip_expr) && bal >= -lines
208209
if s:LookingAt() == ':'
209210
let bal -= !search('\m:\%#','bW')
210211
elseif s:LookingAt() == '?'

0 commit comments

Comments
 (0)