[commit: haskeline] master: Fix #116: type signature of wcwidth foreign call. (47b41ca)
Ian Lynagh
igloo at earth.li
Sat Oct 22 00:53:47 CEST 2011
Repository : ssh://darcs.haskell.org//srv/darcs/packages/haskeline
On branch : master
http://hackage.haskell.org/trac/ghc/changeset/47b41cad04402d52b5579c78adf7d920a27f33d9
>---------------------------------------------------------------
commit 47b41cad04402d52b5579c78adf7d920a27f33d9
Author: Judah Jacobson <judah.jacobson at gmail.com>
Date: Wed Oct 19 17:27:52 2011 +0000
Fix #116: type signature of wcwidth foreign call.
Patch by Peter Herecek.
This fixes a hang when the prompt contains an escape character.
>---------------------------------------------------------------
System/Console/Haskeline/Backend/WCWidth.hs | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/System/Console/Haskeline/Backend/WCWidth.hs b/System/Console/Haskeline/Backend/WCWidth.hs
index fc285d8..f06a165 100644
--- a/System/Console/Haskeline/Backend/WCWidth.hs
+++ b/System/Console/Haskeline/Backend/WCWidth.hs
@@ -13,13 +13,13 @@ import System.Console.Haskeline.LineState
import Data.List
import Foreign.C.Types
-foreign import ccall unsafe mk_wcwidth :: CWchar -> Int
+foreign import ccall unsafe mk_wcwidth :: CWchar -> CInt
wcwidth :: Char -> Int
wcwidth c = case mk_wcwidth $ toEnum $ fromEnum c of
-1 -> 0 -- Control characters have zero width. (Used by the
-- "\SOH...\STX" hack in LineState.stringToGraphemes.)
- w -> w
+ w -> fromIntegral w
gWidth :: Grapheme -> Int
gWidth g = wcwidth (baseChar g)
More information about the Cvs-libraries
mailing list