Skip to content

Commit f203a0d

Browse files
committed
Fix indentation for multiline strings, broken in last commit
1 parent 8b98b7c commit f203a0d

File tree

5 files changed

+23
-11
lines changed

5 files changed

+23
-11
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
(ns test-basic-sexp-indent
2+
"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
3+
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
4+
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
5+
consequat.")
6+
7+
;; vim:ft=clojure:

clj/dev-resources/test-multibyte-indent.in

Lines changed: 0 additions & 5 deletions
This file was deleted.

clj/test/vim_clojure_static/indent_test.clj

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,18 @@
22
(:require [clojure.test :refer [deftest]]
33
[vim-clojure-static.test :refer [test-indent]]))
44

5-
(deftest test-indentation
5+
(deftest test-basic-sexp-indent
6+
(test-indent "works as expected with basic S-expressions"
7+
:in "test-basic-sexp-indent.txt"
8+
:out "test-basic-sexp-indent.txt"))
9+
10+
(deftest test-multibyte-indent
11+
(test-indent "with multibyte characters"
12+
:in "test-multibyte-indent.txt"
13+
:out "test-multibyte-indent.txt"))
14+
15+
(deftest test-inherit-indent
616
(test-indent "is inherited from previous element"
717
:in "test-inherit-indent.in"
818
:out "test-inherit-indent.out"
9-
: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>")
10-
(test-indent "with multibyte characters"
11-
:in "test-multibyte-indent.in"
12-
:out "test-multibyte-indent.out"))
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>"))

indent/clojure.vim

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,10 @@ if exists("*searchpairpos")
307307
function! GetClojureIndent()
308308
let lnum = line('.')
309309
let [opening_lnum, indent] = s:clojure_indent_pos()
310-
let indent -= indent - virtcol([opening_lnum, indent])
310+
311+
if opening_lnum > 0
312+
let indent -= indent - virtcol([opening_lnum, indent])
313+
endif
311314

312315
" Return if there are no previous lines to inherit from
313316
if opening_lnum < 1 || opening_lnum >= lnum - 1

0 commit comments

Comments
 (0)