@@ -191,7 +191,10 @@ function! GetHaskellIndent() abort
191191 endif
192192
193193 if nonblankline = ~# ' \v[)}\]]\s*%(--.*)?$'
194- return s: unindent_after_parenthesis (s: prevnonblank (v: lnum - 1 ), match (nonblankline, ' \v[)}\]]\s*%(--.*)?$' ))
194+ let i = s: unindent_after_parenthesis (s: prevnonblank (v: lnum - 1 ), match (nonblankline, ' \v[)}\]]\s*%(--.*)?$' ))
195+ if i >= 0
196+ return i
197+ endif
195198 endif
196199
197200 if nonblankline = ~# ' \v^\s*\|\s*.*\<-\s*.*,\s*%(--.*)?$'
@@ -245,7 +248,6 @@ function! GetHaskellIndent() abort
245248 if nonblankline = ~# ' \v\{-#\s*UNPACK\s*#-}' && getline (v: lnum ) = ~# ' \v^\s*\{-#\s*UNPACK\s*#-}'
246249 return match (nonblankline, ' \v\{-#\s*UNPACK\s*#-}' )
247250 endif
248- return s: indent (' ' , ' \v^.*<data>.*\zs\=' , 0 )
249251 endif
250252
251253 if nonblankline = ~# ' \v<let>\s+.*\=' && nonblankline !~# ' \v<let>\s+.*\=.*<in>'
@@ -563,7 +565,7 @@ endfunction
563565function ! s: unindent_after_parenthesis (line , column) abort
564566 let i = s: prevnonblank (v: lnum - 1 )
565567 if i < v: lnum - 2
566- return 0
568+ return -1
567569 endif
568570 let pos = getpos (' .' )
569571 let view = winsaveview ()
@@ -572,14 +574,17 @@ function! s:unindent_after_parenthesis(line, column) abort
572574 let begin = getpos (' .' )
573575 call setpos (' .' , pos)
574576 call winrestview (view )
577+ if v: lnum - 1 == begin[1 ]
578+ return -1
579+ endif
575580 if getline (begin[1 ]) = ~# ' \v<deriving>'
576581 let i = begin[1 ]
577582 while i
578583 let line = getline (i )
579584 if getline (i ) = ~# ' \v<data>'
580585 return match (line , ' \v<data>' )
581586 elseif line = ~# ' ^\S'
582- return -1
587+ return 0
583588 endif
584589 let i -= 1
585590 endwhile
0 commit comments