From dfba9956ae4e0d1a485a165cc83bc382580a5513 Mon Sep 17 00:00:00 2001 From: aarne Date: Wed, 17 Aug 2005 13:43:50 +0000 Subject: [PATCH] edit command ct pos --- src/GF/Shell/CommandL.hs | 5 +++-- src/GF/Shell/Commands.hs | 12 ++++++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/GF/Shell/CommandL.hs b/src/GF/Shell/CommandL.hs index df65492c3..79f822c7f 100644 --- a/src/GF/Shell/CommandL.hs +++ b/src/GF/Shell/CommandL.hs @@ -5,9 +5,9 @@ -- Stability : (stable) -- Portability : (portable) -- --- > CVS $Date: 2005/06/11 20:27:05 $ +-- > CVS $Date: 2005/08/17 14:43:50 $ -- > CVS $Author: aarne $ --- > CVS $Revision: 1.19 $ +-- > CVS $Revision: 1.20 $ -- -- (Description of the module) ----------------------------------------------------------------------------- @@ -110,6 +110,7 @@ pCommandMsg s = (m,pCommandWords $ words c) where "'" : _ -> CTop "+" : _ -> CLast "mp" : p -> CMovePosition (readIntList (unwords p)) + "ct" : p -> CCopyPosition (readIntList (unwords p)) "r" : f : _ -> CRefineWithAtom f "w" : f:i : _ -> CWrapWithFun (f, readIntArg i) "ch": f : _ -> CChangeHead f diff --git a/src/GF/Shell/Commands.hs b/src/GF/Shell/Commands.hs index de2ff9a96..2bcf59dba 100644 --- a/src/GF/Shell/Commands.hs +++ b/src/GF/Shell/Commands.hs @@ -5,9 +5,9 @@ -- Stability : (stable) -- Portability : (portable) -- --- > CVS $Date: 2005/06/11 20:27:05 $ +-- > CVS $Date: 2005/08/17 14:43:50 $ -- > CVS $Author: aarne $ --- > CVS $Revision: 1.39 $ +-- > CVS $Revision: 1.40 $ -- -- temporary hacks for GF 2.0 -- @@ -76,6 +76,7 @@ data Command = | CTop | CLast | CMovePosition [Int] + | CCopyPosition [Int] | CRefineWithTree String | CRefineWithClip Int | CRefineWithAtom String @@ -256,6 +257,13 @@ execECommand env c = case c of in (case et of Ok t -> refineByTrees der cgr [t] s Bad m -> changeMsg [m] s) + CCopyPosition p -> action2command $ \s -> do + s1 <- goPosition p s + let t = actTree s1 + let compat = actVal s1 == actVal s + if compat + then refineWithTree der cgr t s + else return s CRefineParse str -> \s -> let cat = cat2CFCat (qualifTop sgr (actCat (stateSState s)))