Skip to content

Commit

Permalink
Revert "Fix charWidth for combining characters."
Browse files Browse the repository at this point in the history
This reverts commit 01d52b4.
  • Loading branch information
jgm committed Oct 17, 2023
1 parent 01d52b4 commit b121dbd
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/Text/DocLayout.hs
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,7 @@ import Control.Monad
import Control.Monad.State.Strict
import GHC.Generics
import Data.Bifunctor (second)
import Data.Char (isSpace, ord,
generalCategory, GeneralCategory(NonSpacingMark))
import Data.Char (isSpace, ord)
import Data.List (foldl', intersperse)
import qualified Data.IntMap.Strict as IM
import qualified Data.Map.Strict as M
Expand Down Expand Up @@ -712,10 +711,7 @@ doubleQuotes = inside (char '"') (char '"')
-- character, 1 for a regular character, 2 for an East Asian wide character.
-- Ambiguous characters are treated as width 1.
charWidth :: Char -> Int
charWidth c
| generalCategory c == NonSpacingMark = 0
| otherwise = extractLength .
updateMatchStateNarrow (MatchState False 0 ' ' 0) $ c
charWidth = extractLength . updateMatchStateNarrow (MatchState False 0 ' ' 0)

-- | Get real length of string, taking into account combining and double-wide
-- characters. Ambiguous characters are treated as width 1.
Expand Down

0 comments on commit b121dbd

Please sign in to comment.