packages feed

haskeline 0.6.4.3 → 0.6.4.4

raw patch · 9 files changed

+47/−28 lines, 9 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

CHANGES view
@@ -1,3 +1,14 @@+Changed in version 0.6.4.4:+   * #115: Fix the behavior of the 'f' and 't' commands when deleting text.+   * #73: Fix regression: pasting multiple lines could drop some characters.+   * Don't require NondecreasingIndentation.++Changed in version 0.6.4.3:+   * Fix a bug on ghc-7.2.1 with tab-completion of Unicode filenames.++Changed in version 0.6.4.2:+   * Various updates for ghc-7.2.1.+ Changed in version 0.6.4:    * Added new function getInputLineWithInitial. 
System/Console/Haskeline/Backend/DumbTerm.hs view
@@ -38,6 +38,7 @@                 TermOps {                         getLayout = tryGetLayouts (posixLayouts h)                         , withGetEvent = withPosixGetEvent ch h enc []+                        , saveUnusedKeys = saveKeys ch                         , runTerm = \(RunTermType f) ->                                      runPosixT enc h                                     $ evalStateT' initWindow
System/Console/Haskeline/Backend/Terminfo.hs view
@@ -153,6 +153,7 @@                     , withGetEvent = wrapKeypad (hOut h) term                                         . withPosixGetEvent ch h enc                                             (terminfoKeys term)+                    , saveUnusedKeys = saveKeys ch                     , runTerm = \(RunTermType f) ->                               runPosixT enc h                               $ evalStateT' initTermPos
System/Console/Haskeline/Backend/Win32.hsc view
@@ -330,6 +330,7 @@                                 getLayout = getBufferSize (hOut hs)
                                 , withGetEvent = withWindowMode hs
                                                     . win32WithEvent hs ch
+                                , saveUnusedKeys = saveKeys ch
                                 , runTerm = \(RunTermType f) ->
                                         runReaderT' hs $ runDraw f
                                 },
System/Console/Haskeline/Command/Completion.hs view
@@ -72,11 +72,11 @@ pagingCompletion k prefs completions = \im -> do         ls <- asks $ makeLines (map display completions)         let pageAction = do-            askFirst prefs (length completions) $ +                askFirst prefs (length completions) $                              if completionPaging prefs                                 then printPage ls                                 else effect (PrintLines ls)-            setState im+                setState im         if listCompletionsImmediately prefs             then pageAction             else effect RingBell >> try (k +> const pageAction) im
System/Console/Haskeline/RunCommand.hs view
@@ -22,9 +22,9 @@ runCommandLoop' tops prefix initState cmds getEvent = do     let s = lineChars prefix initState     drawLine s-    readMoreKeys s (fmap ($ initState) cmds)+    readMoreKeys s (fmap (liftM (\x -> (x,[])) . ($ initState)) cmds)   where-    readMoreKeys :: LineChars -> KeyMap (CmdM m a) -> t m a+    readMoreKeys :: LineChars -> KeyMap (CmdM m (a,[Key])) -> t m a     readMoreKeys s next = do         event <- handle (\(e::SomeException) -> moveToNextLine s                                     >> throwIO e) getEvent@@ -36,7 +36,7 @@                         bound_ks <- mapM (lift . asks . lookupKeyBinding) ks                         loopCmd s $ applyKeysToMap (concat bound_ks) next -    loopCmd :: LineChars -> CmdM m a -> t m a+    loopCmd :: LineChars -> CmdM m (a,[Key]) -> t m a     loopCmd s (GetKey next) = readMoreKeys s next     -- If there are multiple consecutive LineChanges, only render the diff     -- to the last one, and skip the rest. This greatly improves speed when@@ -47,7 +47,10 @@                                     t <- drawEffect prefix s e                                     loopCmd t next     loopCmd s (CmdM next) = lift next >>= loopCmd s-    loopCmd s (Result x) = moveToNextLine s >> return x+    loopCmd s (Result (x,ks)) = do+                                    liftIO (saveUnusedKeys tops ks)+                                    moveToNextLine s+                                    return x   drawEffect :: (MonadTrans t, Term (t m), MonadReader Prefs m)@@ -89,17 +92,18 @@ --------------- -- Traverse through the tree of keybindings, using the given keys. -- Remove as many GetKeys as possible.-applyKeysToMap :: Monad m => [Key] -> KeyMap (CmdM m a)-                                -> CmdM m a+-- Returns any unused keys (so that they can be applied at the next getInputLine).+applyKeysToMap :: Monad m => [Key] -> KeyMap (CmdM m (a,[Key]))+                                -> CmdM m (a,[Key]) applyKeysToMap [] next = GetKey next applyKeysToMap (k:ks) next = case lookupKM next k of     Nothing -> DoEffect RingBell $ GetKey next     Just (Consumed cmd) -> applyKeysToCmd ks cmd     Just (NotConsumed cmd) -> applyKeysToCmd (k:ks) cmd -applyKeysToCmd :: Monad m => [Key] -> CmdM m a-                                -> CmdM m a+applyKeysToCmd :: Monad m => [Key] -> CmdM m (a,[Key])+                                -> CmdM m (a,[Key]) applyKeysToCmd ks (GetKey next) = applyKeysToMap ks next applyKeysToCmd ks (DoEffect e next) = DoEffect e (applyKeysToCmd ks next) applyKeysToCmd ks (CmdM next) = CmdM $ liftM (applyKeysToCmd ks) next-applyKeysToCmd _ (Result x) = Result x+applyKeysToCmd ks (Result (x,ys)) = Result (x,ys++ks) -- use in the next input line
System/Console/Haskeline/Term.hs view
@@ -45,6 +45,7 @@             , withGetEvent :: (MonadException m, CommandMonad m)                                 => (m Event -> m a) -> m a             , runTerm :: (MonadException m, CommandMonad m) => RunTermType m a -> m a+            , saveUnusedKeys :: [Key] -> IO ()         }  -- | Operations needed for file-style interaction.@@ -112,6 +113,8 @@                                 Just ThreadKilled -> return ()                                 _ -> writeChan eventChan (ErrorEvent e) +saveKeys :: Chan Event -> [Key] -> IO ()+saveKeys ch = writeChan ch . KeyInput  data Interrupt = Interrupt                 deriving (Show,Typeable,Eq)
System/Console/Haskeline/Vi.hs view
@@ -144,27 +144,34 @@                             ]  pureMovements :: InputKeyCmd (ArgMode CommandMode) CommandMode-pureMovements = choiceCmd $-            map mkCharCommand charMovements-            ++ map mkSimpleCommand movements+pureMovements = choiceCmd $ charMovements ++ map mkSimpleCommand movements     where+        charMovements = [ charMovement 'f' $ \c -> goRightUntil $ overChar (==c)+                        , charMovement 'F' $ \c -> goLeftUntil $ overChar (==c)+                        , charMovement 't' $ \c -> goRightUntil $ beforeChar (==c)+                        , charMovement 'T' $ \c -> goLeftUntil $ afterChar (==c)+                        ]         mkSimpleCommand (k,move) = k +> change (applyCmdArg move)-        mkCharCommand (k,move) = k +> keyChoiceCmd [+        charMovement c move = simpleChar c +> keyChoiceCmd [                                         useChar (change . applyCmdArg . move)                                         , withoutConsuming (change argState)                                         ]  useMovementsForKill :: Command m s t -> (KillHelper -> Command m s t) -> KeyCommand m s t useMovementsForKill alternate useHelper = choiceCmd $-            map mkCharCommand charMovements-            ++ specialCases+            specialCases             ++ map (\(k,move) -> k +> useHelper (SimpleMove move)) movements     where         specialCases = [ simpleChar 'e' +> useHelper (SimpleMove goToWordDelEnd)                        , simpleChar 'E' +> useHelper (SimpleMove goToBigWordDelEnd)                        , simpleChar '%' +> useHelper (GenericKill deleteMatchingBrace)+                       -- Note 't' and 'f' behave differently than in pureMovements.+                       , charMovement 'f' $ \c -> goRightUntil $ afterChar (==c)+                       , charMovement 'F' $ \c -> goLeftUntil $ overChar (==c)+                       , charMovement 't' $ \c -> goRightUntil $ overChar (==c)+                       , charMovement 'T' $ \c -> goLeftUntil $ afterChar (==c)                        ]-        mkCharCommand (k,move) = k +> keyChoiceCmd [+        charMovement c move = simpleChar c +> keyChoiceCmd [                                     useChar (useHelper . SimpleMove . move)                                     , withoutConsuming alternate] @@ -274,13 +281,6 @@                                 atEnd isWordChar .||. atEnd isOtherChar)             , (simpleChar 'E', goRightUntil (atEnd isBigWordChar))             ]--charMovements :: [(Key, Char -> InsertMode -> InsertMode)]-charMovements = [ (simpleChar 'f', \c -> goRightUntil $ overChar (==c))-                       , (simpleChar 'F', \c -> goLeftUntil $ overChar (==c))-                       , (simpleChar 't', \c -> goRightUntil $ beforeChar (==c))-                       , (simpleChar 'T', \c -> goLeftUntil $ afterChar (==c))-                       ]  {-  From IEEE 1003.1:
haskeline.cabal view
@@ -1,6 +1,6 @@ Name:           haskeline Cabal-Version:  >=1.6-Version:        0.6.4.3+Version:        0.6.4.4 Category:       User Interfaces License:        BSD3 License-File:   LICENSE@@ -69,8 +69,6 @@                 UndecidableInstances                 PatternSignatures, CPP, DeriveDataTypeable,                 PatternGuards-    if impl(ghc >= 7.1)-        Extensions: NondecreasingIndentation     Exposed-Modules:                 System.Console.Haskeline                 System.Console.Haskeline.Completion