Fix Alt-transformation bug with BDFEnsureIndents

multiple BDFEnsureIndent nodes were mistreated previously
pull/124/head
Lennart Spitzner 2018-03-11 22:07:12 +01:00
parent 41a60ce60f
commit af7f9017b8
1 changed files with 10 additions and 5 deletions

View File

@ -319,11 +319,16 @@ transformAlts briDoc =
BrIndentNone -> 0 BrIndentNone -> 0
BrIndentRegular -> indAmount BrIndentRegular -> indAmount
BrIndentSpecial i -> i BrIndentSpecial i -> i
mSet $ acp { _acp_indentPrep = 0 -- TODO: i am not sure this is valid, mSet $ acp
-- in general. { _acp_indentPrep = 0
, _acp_indent = _acp_indent acp + indAdd -- TODO: i am not sure this is valid, in general.
, _acp_line = _acp_line acp + indAdd , _acp_indent = _acp_indent acp + indAdd
} , _acp_line = max (_acp_line acp) (_acp_indent acp + indAdd)
-- we cannot use just _acp_line acp + indAdd because of the case
-- where there are multiple BDFEnsureIndents in the same line.
-- Then, the actual indentation is relative to the current
-- indentation, not the current cursor position.
}
r <- rec bd r <- rec bd
acp' <- mGet acp' <- mGet
mSet $ acp' { _acp_indent = _acp_indent acp } mSet $ acp' { _acp_indent = _acp_indent acp }