Fix one more block-comment restore-position issue

Lennart Spitzner 2023-05-22 16:50:35 +02:00
parent a8119e872c
commit e6956e9264
2 changed files with 12 additions and 1 deletions

View File

@ -1043,3 +1043,11 @@ duGswidunBlxaq drux = DeeX.Vufcqqafi
| otherwise
-> Likiotq
)
#test multiline-block-comment in do-block
func = do
abc
{- some long
block comment -}
x <- readLine
print x

View File

@ -25,6 +25,7 @@ where
import Language.Haskell.Brittany.Internal.Prelude
import qualified Data.Maybe
import qualified Data.Text as Text
import qualified Data.Text.Lazy.Builder as Text.Builder
import qualified GHC.OldList as List
@ -157,7 +158,9 @@ layoutWriteComment absolute isBlock dp commentLines s = do -- TODO92 we don't mo
PlannedNewline l ->
if l <= y then PlannedSameline 1 else PlannedNewline (l - y)
PlannedDelta l i ->
if l <= y then PlannedSameline 1 else PlannedDelta (l - y) i
if l <= y && Data.Maybe.isNothing (_lstate_markerForDelta state)
then PlannedSameline 1
else PlannedDelta (l - y) i
else case _lstate_plannedSpace state of
PlannedNone -> PlannedDelta 1 (_lstate_curY state)
PlannedSameline i -> PlannedDelta 1 (_lstate_curY state + i)