File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ (doseq [x (range 10) y (range 10)]
2+ (println α)
3+ (println β))
Original file line number Diff line number Diff line change 1+ (doseq [x (range 10) y (range 10)]
2+ (println x)
3+ (println y))
Original file line number Diff line number Diff line change 1717 :in " test-inherit-indent.in"
1818 :out " test-inherit-indent.out"
1919 :keys " /α\\ <CR>s\\ <C-O>Oa\\ <Esc>/β\\ <CR>s\\ <CR>\\ <CR>\\ <C-H>\\ <C-H>\\ <C-H>\\ <C-H>\\ <C-H>\\ <C-H>\\ <C-H>b\\ <CR>c\\ <CR>\\ <CR>d\\ <Esc>" ))
20+
21+ (deftest test-side-effects-in-indentexpr
22+ (test-indent " GetClojureIndent does not move cursor"
23+ :in " test-side-effects-in-indentexpr.in"
24+ :out " test-side-effects-in-indentexpr.out"
25+ :keys " /α\\ <CR>:call GetClojureIndent()\\ <CR>rxj:call GetClojureIndent()\\ <CR>ry" ))
Original file line number Diff line number Diff line change @@ -306,7 +306,8 @@ if exists("*searchpairpos")
306306
307307 function ! GetClojureIndent ()
308308 let lnum = line (' .' )
309- let cnum = col (' .' )
309+ let orig_lnum = lnum
310+ let orig_col = col (' .' )
310311 let [opening_lnum, indent ] = s: clojure_indent_pos ()
311312
312313 " Account for multibyte characters
@@ -316,7 +317,7 @@ if exists("*searchpairpos")
316317
317318 " Return if there are no previous lines to inherit from
318319 if opening_lnum < 1 || opening_lnum >= lnum - 1
319- call cursor (lnum, cnum )
320+ call cursor (orig_lnum, orig_col )
320321 return indent
321322 endif
322323
@@ -351,13 +352,13 @@ if exists("*searchpairpos")
351352 " Check if this is part of a multiline string
352353 call cursor (lnum, 1 )
353354 if s: syn_id_name () !~? ' \vstring|regex'
354- call cursor (lnum, cnum )
355+ call cursor (orig_lnum, orig_col )
355356 return indent (lnum)
356357 endif
357358 endif
358359 endwhile
359360
360- call cursor (lnum, cnum )
361+ call cursor (orig_lnum, orig_col )
361362 return indent
362363 endfunction
363364
You can’t perform that action at this time.
0 commit comments