From b121dbd798586b673e16de30eee68e7f81ed2616 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Mon, 16 Oct 2023 23:48:32 -0700 Subject: [PATCH] Revert "Fix charWidth for combining characters." This reverts commit 01d52b45611fc5cdbc49a7dde936f90faf8ce6f3. --- src/Text/DocLayout.hs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/Text/DocLayout.hs b/src/Text/DocLayout.hs index 3b970fb..8d18d44 100644 --- a/src/Text/DocLayout.hs +++ b/src/Text/DocLayout.hs @@ -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 @@ -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.