File tree Expand file tree Collapse file tree 1 file changed +14
-14
lines changed
Expand file tree Collapse file tree 1 file changed +14
-14
lines changed Original file line number Diff line number Diff line change @@ -113,25 +113,25 @@ endfunction
113113" backtrack to find guard clause
114114function ! s: indentGuard (pos, prevline)
115115 let l: l = a: prevline
116- let l: c = 1
117-
118- while v: lnum != l: c
119- " empty line, stop looking
120- if l: l = ~ ' ^$'
121- return a: pos
122- " guard found
123- elseif l: l = ~ ' ^\s*|\s\+'
124- return match (l: l , ' |' )
125- " found less deeper indentation (not starting with `,` or `=`)
126- " stop looking
116+ let l: c = v: lnum - 1
117+
118+ while l: c >= 1
119+ if l: l = ~ ' ^\S'
120+ " top-level start, stop looking
121+ return g: haskell_indent_guard
122+ elseif l: l = ~ ' ^\s\+[|,=]\s\+'
123+ " guard block found
124+ return match (l: l , ' [|,=]' )
127125 else
128126 let l: m = match (l: l , ' \S' )
129- if l: l !~ ' ^\s*[=,]' && l: m <= a: pos
127+ if l: m >= 0 && l: m <= a: pos
128+ " found less deeper indentation (not starting with `,` or `=`)
129+ " stop looking
130130 return l: m + g: haskell_indent_guard
131131 endif
132132 endif
133- let l: c + = 1
134- let l: l = getline (v: lnum - l: c )
133+ let l: c - = 1
134+ let l: l = getline (l: c )
135135 endwhile
136136
137137 return -1
You can’t perform that action at this time.
0 commit comments