Fix ColumnAlign problem for multibyte strings #122

pull/123/head
waddlaw 2018-02-26 17:46:18 +09:00
parent 1e8d62232c
commit 62f2f4977d
2 changed files with 4 additions and 4 deletions

View File

@ -264,7 +264,7 @@ briDocLineLength briDoc = flip StateS.evalState False $ rec briDoc
where
rec = \case
BDEmpty -> return $ 0
BDLit t -> StateS.put False $> Text.length t
BDLit t -> StateS.put False $> elasticLength t
BDSeq bds -> sum <$> rec `mapM` bds
BDCols _ bds -> sum <$> rec `mapM` bds
BDSeparator -> StateS.get >>= \b -> StateS.put True $> if b then 0 else 1

View File

@ -99,7 +99,7 @@ layoutWriteAppend t = do
mTell $ Text.Builder.fromText $ t
mModify $ \s -> s
{ _lstate_curYOrAddNewline = Left $ case _lstate_curYOrAddNewline s of
Left c -> c + Text.length t + spaces
Left c -> c + elasticLength t + spaces
Right{} -> Text.length t + spaces
, _lstate_addSepSpace = Nothing
}
@ -170,7 +170,7 @@ layoutWriteNewlineBlock = do
-- mSet $ state
-- { _lstate_addSepSpace = Just
-- $ if isJust $ _lstate_addNewline state
-- then i
-- then i
-- else _lstate_indLevelLinger state + i - _lstate_curY state
-- }
@ -600,7 +600,7 @@ layoutIndentRestorePostComment = do
-- layoutWritePriorCommentsRestore x = do
-- layoutWritePriorComments x
-- layoutIndentRestorePostComment
--
--
-- layoutWritePostCommentsRestore :: (Data.Data.Data ast,
-- MonadMultiWriter Text.Builder.Builder m,
-- MonadMultiState LayoutState m