Skip to content

Commit fe60b97

Browse files
sethyuanguns
authored andcommitted
Eliminate cursor side-effect in GetClojureIndent().
1 parent 184f7aa commit fe60b97

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

indent/clojure.vim

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,14 +308,14 @@ if exists("*searchpairpos")
308308
let lnum = line('.')
309309
let cnum = col('.')
310310
let [opening_lnum, indent] = s:clojure_indent_pos()
311-
call cursor(lnum, cnum)
312311

313312
if opening_lnum > 0
314313
let indent -= indent - virtcol([opening_lnum, indent])
315314
endif
316315

317316
" Return if there are no previous lines to inherit from
318317
if opening_lnum < 1 || opening_lnum >= lnum - 1
318+
call cursor(lnum, cnum)
319319
return indent
320320
endif
321321

@@ -350,11 +350,13 @@ if exists("*searchpairpos")
350350
" Check if this is part of a multiline string
351351
call cursor(lnum, 1)
352352
if s:syn_id_name() !~? '\vstring|regex'
353+
call cursor(lnum, cnum)
353354
return indent(lnum)
354355
endif
355356
endif
356357
endwhile
357358

359+
call cursor(lnum, cnum)
358360
return indent
359361
endfunction
360362

0 commit comments

Comments
 (0)