File tree Expand file tree Collapse file tree 4 files changed +17
-4
lines changed Expand file tree Collapse file tree 4 files changed +17
-4
lines changed 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 17
17
:in " test-inherit-indent.in"
18
18
:out " test-inherit-indent.out"
19
19
: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")
306
306
307
307
function ! GetClojureIndent ()
308
308
let lnum = line (' .' )
309
- let cnum = col (' .' )
309
+ let orig_lnum = lnum
310
+ let orig_col = col (' .' )
310
311
let [opening_lnum, indent ] = s: clojure_indent_pos ()
311
312
312
313
" Account for multibyte characters
@@ -316,7 +317,7 @@ if exists("*searchpairpos")
316
317
317
318
" Return if there are no previous lines to inherit from
318
319
if opening_lnum < 1 || opening_lnum >= lnum - 1
319
- call cursor (lnum, cnum )
320
+ call cursor (orig_lnum, orig_col )
320
321
return indent
321
322
endif
322
323
@@ -351,13 +352,13 @@ if exists("*searchpairpos")
351
352
" Check if this is part of a multiline string
352
353
call cursor (lnum, 1 )
353
354
if s: syn_id_name () !~? ' \vstring|regex'
354
- call cursor (lnum, cnum )
355
+ call cursor (orig_lnum, orig_col )
355
356
return indent (lnum)
356
357
endif
357
358
endif
358
359
endwhile
359
360
360
- call cursor (lnum, cnum )
361
+ call cursor (orig_lnum, orig_col )
361
362
return indent
362
363
endfunction
363
364
You can’t perform that action at this time.
0 commit comments