Skip to content

Commit d025136

Browse files
committed
Bug fix: ignore 'do' matches inside words
1 parent f5ae0ac commit d025136

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

indent/haskell.vim

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,9 @@ function! GetHaskellIndent() abort
129129

130130
if nonblankline =~# '\v<do>\s*[[:alnum:](]'
131131
let i = strridx(nonblankline, 'do ')
132+
while i >= 1 && nonblankline[i - 1] =~# '\k'
133+
let i = strridx(nonblankline, 'do ', i - 1)
134+
endwhile
132135
return match(nonblankline, '\v<do>\s*\zs', i)
133136
endif
134137

test/do/double_do.in.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
do foo <- do bar <- baz
1+
do foo <- do undo <- baz
22
qux
33
quux

test/do/double_do.out.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
do foo <- do bar <- baz
1+
do foo <- do undo <- baz
22
qux
33
quux

0 commit comments

Comments
 (0)