packages feed

yi-core 0.19.2 → 0.19.3

raw patch · 23 files changed

+78/−64 lines, 23 filesdep ~basenew-uploader

Dependency ranges changed: base

Files

src/System/FriendlyPath.hs view
@@ -1,3 +1,5 @@+{-# LANGUAGE CPP #-}+ module System.FriendlyPath   ( userToCanonPath   , expandTilda@@ -7,7 +9,9 @@ import System.CanonicalizePath (canonicalizePath) import System.Directory        (getHomeDirectory) import System.FilePath         (isAbsolute, normalise, pathSeparator)-import System.PosixCompat.User (getUserEntryForName, homeDirectory)+#ifndef mingw32_HOST_OS+import System.Posix.User (getUserEntryForName, homeDirectory)+#endif   -- canonicalizePath follows symlinks, and does not work if the directory does not exist.@@ -20,10 +24,15 @@ expandTilda :: String -> IO FilePath expandTilda ('~':path)   | null path || (head path == pathSeparator) = (++ path) <$> getHomeDirectory+#ifndef mingw32_HOST_OS   -- Home directory of another user, e.g. ~root/   | otherwise = let username = takeWhile (/= pathSeparator) path                     dirname = drop (length username) path                 in  (normalise . (++ dirname) . homeDirectory) <$> getUserEntryForName username+#else+  -- unix-compat no longer helps+  | otherwise = ioError $ mkIOError illegalOperationErrorType "Tilda expansion only supported under Unix" Nothing Nothing+#endif expandTilda path = return path  -- | Is a user-friendly path absolute?
src/Yi.hs view
@@ -8,7 +8,7 @@ -- Stability   :  experimental -- Portability :  portable ----- Facade of the Yi library, for use by confguration file. Just+-- Facade of the Yi library, for use by configuration file. Just -- re-exports a bunch of modules. -- -- You should therefore:
src/Yi/Buffer/HighLevel.hs view
@@ -216,28 +216,28 @@     then moveTo start     else when (style == Exclusive && b == c) moveBack --- | Move to the next occurence of @c@+-- | Move to the next occurrence of @c@ nextCInc :: Char -> BufferM () nextCInc c = gotoCharacterB c Forward Inclusive False  nextCInLineInc :: Char -> BufferM () nextCInLineInc c = gotoCharacterB c Forward Inclusive True --- | Move to the character before the next occurence of @c@+-- | Move to the character before the next occurrence of @c@ nextCExc :: Char -> BufferM () nextCExc c = gotoCharacterB c Forward Exclusive False  nextCInLineExc :: Char -> BufferM () nextCInLineExc c = gotoCharacterB c Forward Exclusive True --- | Move to the previous occurence of @c@+-- | Move to the previous occurrence of @c@ prevCInc :: Char -> BufferM () prevCInc c = gotoCharacterB c Backward Inclusive False  prevCInLineInc :: Char -> BufferM () prevCInLineInc c = gotoCharacterB c Backward Inclusive True --- | Move to the character after the previous occurence of @c@+-- | Move to the character after the previous occurrence of @c@ prevCExc :: Char -> BufferM () prevCExc c = gotoCharacterB c Backward Exclusive False @@ -1135,7 +1135,7 @@        | otherwise                                            -> return False  -- | Characters ['a'..'f'] are part of a hex number only if preceded by 0x.--- Test if the current occurence of ['a'..'f'] is part of a hex number.+-- Test if the current occurrence of ['a'..'f'] is part of a hex number. testHexB :: BufferM Bool testHexB = savingPointB $ do     untilB_ (not . isHexDigit <$> readB) (moveXorSol 1)
src/Yi/Buffer/Indent.hs view
@@ -221,7 +221,7 @@   -- add one to the count. When we see an opening bracket   -- decrease the count. If we see an opening bracket when the   -- count is 0 we return the remaining (reversed) string-  -- as the part of the line which preceds the last opening bracket.+  -- as the part of the line which precedes the last opening bracket.   -- This can then be turned into an indentation by calling 'spacingOfB'   -- on it so that tabs are counted as tab length.   -- NOTE: that this will work even if tab occur in the middle of the line
src/Yi/Buffer/Misc.hs view
@@ -1127,7 +1127,7 @@     moveTo =<< use (markPointA m)     return res -markPointA :: Mark -> Lens' FBuffer Point+markPointA :: forall f . Functor f => Mark -> (Point -> f Point) -> (FBuffer -> f FBuffer) markPointA mark = lens getter setter where   getter b = markPoint $ getMarkValueRaw mark b   setter b pos = modifyMarkRaw mark (\v -> v {markPoint = pos}) b
src/Yi/Buffer/Undo.hs view
@@ -22,12 +22,12 @@ -- >    affecting the Redo list. -- -- Now, the above assumes that commands can be _redone_ in a state other--- than that in which it was orginally done. This is not the case in our+-- than that in which it was originally done. This is not the case in our -- text editor: a user may delete, for example, between an undo and a -- redo. Berlage addresses this in S2.3. A Yi example: -- -- >    Delete some characters--- >    Undo partialy+-- >    Undo partially -- >    Move prior in the file, and delete another _chunk_ -- >    Redo some things  == corruption. --@@ -115,7 +115,7 @@ undoU :: Mark -> URList -> BufferImpl syntax -> (BufferImpl syntax, (URList, S.Seq Update)) undoU m = undoUntilInteractive m mempty . undoInteractive --- | This redoes one iteraction step.+-- | This redoes one interaction step. redoU :: Mark -> URList -> BufferImpl syntax -> (BufferImpl syntax, (URList, S.Seq Update)) redoU = asRedo . undoU 
src/Yi/Command.hs view
@@ -91,7 +91,7 @@ reloadProjectE :: String -> YiM () reloadProjectE s = withUI $ \ui -> reloadProject ui s --- | Run the given commands with args and pipe the ouput into the build buffer,+-- | Run the given commands with args and pipe the output into the build buffer, -- which is shown in an other window. buildRun :: T.Text -> [T.Text] -> (Either SomeException ExitCode -> YiM x) -> YiM () buildRun cmd args onExit = withOtherWindow $ do
src/Yi/Config/Simple.hs view
@@ -328,7 +328,7 @@ These fields are here for completeness -- that is, to expose all the functionality of the "Yi.Config" module. However, most users probably need not use these fields, typically because they provide advanced-functinality, or because a simpler interface for the common case is+functionality, or because a simpler interface for the common case is available above.  -}
src/Yi/Core.hs view
@@ -337,7 +337,7 @@ -- | Pipe a string through an external command, returning the stdout -- chomp any trailing newline (is this desirable?) ----- Todo: varients with marks?+-- Todo: variants with marks? -- runProcessWithInput :: String -> String -> YiM String runProcessWithInput cmd inp = do
src/Yi/Dired.hs view
@@ -89,11 +89,13 @@                                            readSymbolicLink, removeLink, rename,                                            unionFileModes) import           System.PosixCompat.Types (FileMode, GroupID, UserID)-import           System.PosixCompat.User  (GroupEntry, GroupEntry (..),+#ifndef mingw32_HOST_OS+import           System.Posix.User        (GroupEntry, GroupEntry (..),                                            UserEntry (..), getAllGroupEntries,                                            getAllUserEntries,                                            getGroupEntryForID,                                            getUserEntryForID, groupID, userID)+#endif import           Text.Printf              (printf) import           Yi.Buffer import           Yi.Config                (modeTable)@@ -414,11 +416,11 @@ -- showNothing -- -- 2. Confirmation is required for recursive deletion of non-empty--- directry, but only the top level one+-- directory, but only the top level one ----- 3. Show the number of successful deletions at the end of the excution+-- 3. Show the number of successful deletions at the end of the execution ----- 4. TODO: ask confirmation for wether to remove the associated+-- 4. TODO: ask confirmation for whether to remove the associated -- buffers when a file is removed askDelFiles :: FilePath -> [(FilePath, DiredEntry)] -> YiM () askDelFiles dir fs =@@ -665,6 +667,7 @@                 -> DiredEntries                 -> FilePath                 -> IO DiredEntries+#ifndef mingw32_HOST_OS     lineForFile d m f = do       let fp = d </> f       fileStatus <- getSymbolicLinkStatus fp@@ -709,7 +712,6 @@                            , sizeInBytes = sz                            , modificationTimeString = modTimeStr} - -- | Needed on Mac OS X 10.4 scanForUid :: UserID -> [UserEntry] -> UserEntry scanForUid uid entries = fromMaybe missingEntry $@@ -724,6 +726,10 @@   where     missingEntry = GroupEntry "?" mempty gid mempty +#else+    -- has been the default for Windows anyway, so just directly do it without unix-compat+    lineForFile _ m f = return $ M.insert (R.fromString f) DiredNoInfo m+#endif  modeString :: FileMode -> R.YiString modeString fm = ""@@ -1081,7 +1087,7 @@  -- | Elementary operations for dired file operations -- Map a dired mark operation (e.g. delete, rename, copy) command--- into a list of DiredOps, and use procDiredOp to excute them.+-- into a list of DiredOps, and use procDiredOp to execute them. -- Logic and implementation of each operation are packaged in procDiredOp -- See askDelFiles for example. -- If new elem op is added, just add corresponding procDiredOp to handle it.
src/Yi/Editor.hs view
@@ -459,7 +459,7 @@ -- | Dynamically-extensible state components. -- -- These hooks are used by keymaps to store values that result from--- Actions (i.e. that restult from IO), as opposed to the pure values+-- Actions (i.e. that result from IO), as opposed to the pure values -- they generate themselves, and can be stored internally. -- -- The `dynamic' field is a type-indexed map.
src/Yi/Eval.hs view
@@ -121,28 +121,6 @@ a <&> f = f <$> a -- TODO: should we be sticking Text here? --- | Runs the action, as written by the user.------ The behaviour of this function can be customised by modifying the--- 'Evaluator' variable.-execEditorAction :: String -> YiM ()-execEditorAction = runHook execEditorActionImpl---- | Lists the action names in scope, for use by 'execEditorAction',--- and 'help' index.------ The behaviour of this function can be customised by modifying the--- 'Evaluator' variable.-getAllNamesInScope :: YiM [String]-getAllNamesInScope = runHook getAllNamesInScopeImpl---- | Describes the named action in scope, for use by 'help'.------ The behaviour of this function can be customised by modifying the--- 'Evaluator' variable.-describeNamedAction :: String -> YiM String-describeNamedAction = runHook describeNamedActionImpl- -- | Config variable for customising the behaviour of -- 'execEditorAction' and 'getAllNamesInScope'. --@@ -157,11 +135,6 @@     -- ^ describe named action (or at least its type.), simplest implementation is at least @return@.   } deriving (Typeable) --- | The evaluator to use for 'execEditorAction' and--- 'getAllNamesInScope'.-evaluator :: Field Evaluator-evaluator = customVariable- -- * Evaluator based on GHCi -- | Cached variable for getAllNamesInScopeImpl newtype NamesCache = NamesCache [String] deriving (Typeable, Binary)@@ -170,7 +143,7 @@     def = NamesCache [] instance YiVariable NamesCache --- | Cached dictioary for describeNameImpl+-- | Cached dictionary for describeNameImpl newtype HelpCache = HelpCache (M.HashMap String String) deriving (Typeable, Binary)  instance Default HelpCache where@@ -413,3 +386,29 @@ #endif  instance YiConfigVariable Evaluator+-- | Runs the action, as written by the user.+--+-- The behaviour of this function can be customised by modifying the+-- 'Evaluator' variable.+execEditorAction :: String -> YiM ()+execEditorAction = runHook execEditorActionImpl++-- | Lists the action names in scope, for use by 'execEditorAction',+-- and 'help' index.+--+-- The behaviour of this function can be customised by modifying the+-- 'Evaluator' variable.+getAllNamesInScope :: YiM [String]+getAllNamesInScope = runHook getAllNamesInScopeImpl++-- | Describes the named action in scope, for use by 'help'.+--+-- The behaviour of this function can be customised by modifying the+-- 'Evaluator' variable.+describeNamedAction :: String -> YiM String+describeNamedAction = runHook describeNamedActionImpl++-- | The evaluator to use for 'execEditorAction' and+-- 'getAllNamesInScope'.+evaluator :: Field Evaluator+evaluator = customVariable
src/Yi/MiniBuffer.hs view
@@ -93,7 +93,7 @@  -- | Open a minibuffer window with the given prompt and keymap -- The third argument is an action to perform after the minibuffer--- is opened such as move to the first occurence of a searched for+-- is opened such as move to the first occurrence of a searched for -- string. If you don't need this just supply @return ()@ spawnMinibufferE :: T.Text -> KeymapEndo -> EditorM BufferRef spawnMinibufferE prompt kmMod = do@@ -109,7 +109,7 @@   -- Second: The users of the minibuffer expect the window and buffer that was in   -- focus when the minibuffer was spawned to be in focus when the minibuffer is closed   -- Given that window focus works as follows:-  --    - The new window is broguht into focus.+  --    - The new window is brought into focus.   --    - The previous window in focus is to the left of the new window in the window   --    set list.   --    - When a window is deleted and is in focus then the window to the left is brought
src/Yi/Mode/Interactive.hs view
@@ -119,7 +119,7 @@   withEditor interactHistoryStart   sendToProcess b cmd --- | Send command, recieve reply+-- | Send command, receive reply queryReply :: BufferRef -> String -> YiM R.YiString queryReply buf cmd = do     start <- withGivenBuffer buf (botB >> pointB)
src/Yi/Process.hs view
@@ -68,7 +68,7 @@  createProcess (proc cmd args){ std_out = CreatePipe,                                 std_err = UseHandle stdout } -Therefore it should be possible to simplifiy the following greatly with the new process package.+Therefore it should be possible to simplify the following greatly with the new process package.  -} createSubprocess :: FilePath -> [String] -> BufferRef -> IO SubprocessInfo
src/Yi/Search.hs view
@@ -351,7 +351,7 @@       word = T.takeWhile isAlpha rest   isearchAddE $ prefix <> word --- | Succesfully finish a search. Also see 'isearchFinishWithE'.+-- | Successfully finish a search. Also see 'isearchFinishWithE'. isearchFinishE :: EditorM () isearchFinishE = isearchEnd True @@ -414,7 +414,7 @@ qrReplaceAll :: Window -> BufferRef -> SearchExp -> R.YiString -> EditorM () qrReplaceAll win b what replacement = do   n <- withGivenBufferAndWindow win b $ do-    exchangePointAndMarkB -- so we replace the current occurence too+    exchangePointAndMarkB -- so we replace the current occurrence too     searchAndRepRegion0 what replacement True =<< regionOfPartB Document Forward   printMsg $ "Replaced " <> showT n <> " occurrences"   qrFinish
src/Yi/String.hs view
@@ -74,7 +74,7 @@         (h, hs) -> T.toUpper h <> hs  -- | Remove any trailing strings matching /irs/ (input record separator)--- from input string. Like perl's chomp(1).+-- from input string. Like Perl's chomp(1). chomp :: String -> String -> String chomp irs st     | irs `isSuffixOf` st
src/Yi/Syntax/Layout.hs view
@@ -70,7 +70,7 @@            parse :: IState t -> [(AlexState lexState, Tok t)] -> [(State t lexState, Tok t)]           parse iSt@(IState levels doOpen lastLine)-                toks@((aSt, tok @ Tok {tokPosn = Posn _nextOfs line col}) : tokss)+                toks@((aSt, tok@Tok {tokPosn = Posn _nextOfs line col}) : tokss)              -- ignore this token             | isIgnored tok
src/Yi/TextCompletion.hs view
@@ -70,7 +70,7 @@ resetComplete :: EditorM () resetComplete = putEditorDyn (Completion []) --- | Try to complete the current word with occurences found elsewhere in the+-- | Try to complete the current word with occurrences found elsewhere in the -- editor. Further calls try other options. mkWordComplete :: YiM T.Text -- ^ Extract function                -> (T.Text -> YiM [T.Text]) -- ^ Source function
src/Yi/Types.hs view
@@ -214,9 +214,9 @@     , undos  :: !URList -- ^ undo/redo list     , bufferDynamic :: !DynamicState.DynamicState -- ^ dynamic components     , preferCol :: !(Maybe Int)-    -- ^ prefered column to arrive at when we do a lineDown / lineUp+    -- ^ preferred column to arrive at when we do a lineDown / lineUp     , preferVisCol :: !(Maybe Int)-    -- ^ prefered column to arrive at visually (ie, respecting wrap)+    -- ^ preferred column to arrive at visually (ie, respecting wrap)     , stickyEol :: !Bool     -- ^ stick to the end of line (used by vim bindings mostly)     , pendingUpdates :: !(S.Seq UIUpdate)
src/Yi/UI/Common.hs view
@@ -42,7 +42,7 @@ The Yi core provides no guarantee about the OS thread from which the functions 'layout' and 'refresh' are called from. In particular, subprocesses (e.g. compilation, ghci) will run 'layout' and 'refresh' from new OS threads (see @startSubprocessWatchers@-in "Yi.Core"). The frontend must be preparaed for this: for instance, Gtk-based frontends+in "Yi.Core"). The frontend must be prepared for this: for instance, Gtk-based frontends should wrap GUI updates in @postGUIAsync@. -} data UI e = UI
src/Yi/UI/Utils.hs view
@@ -49,7 +49,7 @@ -- | Turn a sequence of (from,style,to) strokes into a sequence --   of picture points (from,style), taking special care to --   ensure that the points are strictly increasing and introducing---   padding segments where neccessary.+--   padding segments where necessary. --   Precondition: Strokes are ordered and not overlapping. strokePicture :: [Span (Endo a)] -> [(Point,a -> a)] strokePicture [] = []
yi-core.cabal view
@@ -1,5 +1,5 @@ name:           yi-core-version:        0.19.2+version:        0.19.3 synopsis:       Yi editor core library category:       Yi homepage:       https://github.com/yi-editor/yi#readme