Skip to content

Commit f5ae0ac

Browse files
committed
Fix case of multiple 'do' blocks on the same line
1 parent 65647b8 commit f5ae0ac

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

indent/haskell.vim

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
" Filename: indent/haskell.vim
33
" Author: itchyny
44
" License: MIT License
5-
" Last Change: 2024/11/01 20:51:18.
5+
" Last Change: 2025/03/01 19:41:22.
66
" =============================================================================
77

88
if exists('b:did_indent')
@@ -128,7 +128,8 @@ function! GetHaskellIndent() abort
128128
endif
129129

130130
if nonblankline =~# '\v<do>\s*[[:alnum:](]'
131-
return match(nonblankline, '\v<do>\s*\zs\S')
131+
let i = strridx(nonblankline, 'do ')
132+
return match(nonblankline, '\v<do>\s*\zs', i)
132133
endif
133134

134135
if line =~# '\v<if>' && line !~# '\v^\s*#'

test/do/double_do.in.hs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
do foo <- do bar <- baz
2+
qux
3+
quux

test/do/double_do.out.hs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
do foo <- do bar <- baz
2+
qux
3+
quux

0 commit comments

Comments
 (0)