yi-keymap-vim 0.13.7 → 0.14.0
raw patch · 9 files changed
+78/−87 lines, 9 files
Files
- src/Yi/Keymap/Vim/Ex.hs +0/−2
- src/Yi/Keymap/Vim/Ex/Commands/Reload.hs +0/−25
- src/Yi/Keymap/Vim/Motion.hs +5/−5
- src/Yi/Keymap/Vim/VisualMap.hs +2/−2
- tests/Generic/TestPureBufferManipulations.hs +4/−5
- tests/Vim/EditorManipulations/BufferExCommand.hs +45/−45
- tests/Vim/TestExCommandParsers.hs +0/−1
- tests/vimtests/sort/6.test +20/−0
- yi-keymap-vim.cabal +2/−2
src/Yi/Keymap/Vim/Ex.hs view
@@ -30,7 +30,6 @@ import qualified Yi.Keymap.Vim.Ex.Commands.Paste as Paste (parse) import qualified Yi.Keymap.Vim.Ex.Commands.Quit as Quit (parse) import qualified Yi.Keymap.Vim.Ex.Commands.Read as Read (parse)-import qualified Yi.Keymap.Vim.Ex.Commands.Reload as Reload (parse) import qualified Yi.Keymap.Vim.Ex.Commands.Shell as Shell (parse) import qualified Yi.Keymap.Vim.Ex.Commands.Sort as Sort (parse) import qualified Yi.Keymap.Vim.Ex.Commands.Substitute as Substitute (parse)@@ -60,7 +59,6 @@ , Paste.parse , Quit.parse , Read.parse- , Reload.parse , Sort.parse , Substitute.parse , Shell.parse
− src/Yi/Keymap/Vim/Ex/Commands/Reload.hs
@@ -1,25 +0,0 @@-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_HADDOCK show-extensions #-}---- |--- Module : Yi.Keymap.Vim.Ex.Commands.Reload--- License : GPL-2--- Maintainer : yi-devel@googlegroups.com--- Stability : experimental--- Portability : portable--module Yi.Keymap.Vim.Ex.Commands.Reload (parse) where--import Data.Text ()-import Yi.Boot.Internal (reload)-import Yi.Keymap (Action (YiA))-import Yi.Keymap.Vim.Common (EventString)-import Yi.Keymap.Vim.Ex.Commands.Common (impureExCommand)-import Yi.Keymap.Vim.Ex.Types (ExCommand (cmdAction, cmdShow))--parse :: EventString -> Maybe ExCommand-parse "reload" = Just $ impureExCommand {- cmdShow = "reload"- , cmdAction = YiA reload- }-parse _ = Nothing
src/Yi/Keymap/Vim/Motion.hs view
@@ -205,12 +205,12 @@ matchGotoCharMove (m:[]) | m `elem` ('f' : "FtT") = PartialMatch matchGotoCharMove (m:"<lt>") | m `elem` ('f' : "FtT") = matchGotoCharMove (m:"<") matchGotoCharMove (m:c:[]) | m `elem` ('f' : "FtT") = WholeMatch $ Move style False action- where (dir, style, move, offset) =+ where (style, move, offset) = case m of- 'f' -> (Forward, Inclusive, nextCInLineInc c, pure ())- 't' -> (Forward, Inclusive, nextCInLineInc c, moveB Character Backward)- 'F' -> (Backward, Exclusive, prevCInLineInc c, pure ())- 'T' -> (Backward, Exclusive, prevCInLineInc c, moveB Character Forward)+ 'f' -> (Inclusive, nextCInLineInc c, pure ())+ 't' -> (Inclusive, nextCInLineInc c, moveB Character Backward)+ 'F' -> (Exclusive, prevCInLineInc c, pure ())+ 'T' -> (Exclusive, prevCInLineInc c, moveB Character Forward) _ -> error "can't happen" action mcount = do let count = fromMaybe 1 mcount
src/Yi/Keymap/Vim/VisualMap.hs view
@@ -30,7 +30,7 @@ import Yi.Keymap.Vim.Utils (matchFromBool, mkChooseRegisterBinding, mkMotionBinding, addNewLineIfNecessary) import Yi.MiniBuffer (spawnMinibufferE) import Yi.Monad (whenM)-import qualified Yi.Rope as R (toText, countNewLines)+import qualified Yi.Rope as R (toText) import Yi.Tag (Tag (Tag)) import Yi.Utils (SemiNum ((-~))) @@ -253,7 +253,7 @@ void $ deleteRegionWithStyleB reg Block moveTo (minimum [here, there, here', there']) insertRopeWithStyleB rope Block- (Just (Register _ rope), Block) ->+ (Just (Register _ _), Block) -> printMsg "Pasting non-block string into a block selection is not implemented" (Just (Register _style rope), _) -> withCurrentBuffer $ do region <- regionOfSelectionB
tests/Generic/TestPureBufferManipulations.hs view
@@ -4,7 +4,7 @@ -- cursor. For example, opening a second buffer is not considered a pure buffer -- operation. -module Generic.TestPureBufferManipulations where+module Generic.TestPureBufferManipulations (getTests) where import Test.Tasty.HUnit import Test.Tasty (TestTree, testGroup)@@ -24,7 +24,6 @@ import Yi.Config (Config) import Yi.Editor import Yi.Window-import Yi.Region import Generic.TestUtils @@ -152,9 +151,9 @@ return $ testsFromDirs ++ testsFromFiles optionalSettingAction :: OptionalSetting -> EditorM ()-optionalSettingAction (WindowSize w h) = - let region = mkSizeRegion (Point 0) (Size (w*h))- in currentWindowA %= (\w -> w { height = h, actualLines = h, winRegion = region })+optionalSettingAction (WindowSize width' height') = + let region = mkSizeRegion (Point 0) (Size (width' * height'))+ in currentWindowA %= (\w -> w { height = height', actualLines = height', winRegion = region }) mkTestCase :: Config -> KeymapTest -> TestTree mkTestCase cf t = testCase (ktName t) $ do
tests/Vim/EditorManipulations/BufferExCommand.hs view
@@ -14,7 +14,7 @@ type BufferName = String --- | Create three buffers and return the 'BufferRef' and buffer name of+-- | Create three bufs and return the 'BufferRef' and buffer name of -- each. createInitialBuffers :: EditorM [(BufferRef, BufferName)] createInitialBuffers = do@@ -25,10 +25,10 @@ nthBufferRef :: Int -> [(BufferRef, BufferName)] -> BufferRef-nthBufferRef n buffers = fst $ buffers !! n+nthBufferRef n bufs = fst $ bufs !! n nthBufferName :: Int -> [(BufferRef, BufferName)] -> BufferName-nthBufferName n buffers = snd $ buffers !! n+nthBufferName n bufs = snd $ bufs !! n tests :: Config -> KeyEval -> TestTree@@ -37,15 +37,15 @@ testCase ":buffer {bufname} switches to the named buffer" $ do let setupActions = createInitialBuffers - preConditions editor buffers =- assertNotCurrentBuffer (nthBufferRef 1 buffers) editor+ preConditions editor bufs =+ assertNotCurrentBuffer (nthBufferRef 1 bufs) editor - testActions buffers =- ev $ ":buffer " ++ nthBufferName 1 buffers ++ "<CR>"+ testActions bufs =+ ev $ ":buffer " ++ nthBufferName 1 bufs ++ "<CR>" - assertions editor buffers = do+ assertions editor bufs = do assertContentOfCurrentBuffer c "Buffer two" editor- assertCurrentBuffer (nthBufferRef 1 buffers) editor+ assertCurrentBuffer (nthBufferRef 1 bufs) editor runTest setupActions preConditions testActions assertions c @@ -53,16 +53,16 @@ , testCase ":buffer N switches to the numbered buffer" $ do let setupActions = createInitialBuffers - preConditions editor buffers =- assertNotCurrentBuffer (nthBufferRef 1 buffers) editor+ preConditions editor bufs =+ assertNotCurrentBuffer (nthBufferRef 1 bufs) editor - testActions buffers =- let (BufferRef bref) = nthBufferRef 1 buffers+ testActions bufs =+ let (BufferRef bref) = nthBufferRef 1 bufs in ev $ ":buffer " ++ show bref ++ "<CR>" - assertions editor buffers = do+ assertions editor bufs = do assertContentOfCurrentBuffer c "Buffer two" editor- assertCurrentBuffer (nthBufferRef 1 buffers) editor+ assertCurrentBuffer (nthBufferRef 1 bufs) editor runTest setupActions preConditions testActions assertions c @@ -70,17 +70,17 @@ , testCase ":buffer # switches to the previous buffer" $ do let setupActions = createInitialBuffers - preConditions editor buffers =+ preConditions editor bufs = assertEqual "Unexpected buffer stack"- [nthBufferRef 2 buffers, nthBufferRef 1 buffers]+ [nthBufferRef 2 bufs, nthBufferRef 1 bufs] (take 2 . NE.toList $ bufferStack editor) testActions _ = ev $ ":buffer #<CR>" - assertions editor buffers = do+ assertions editor bufs = do assertEqual "Unexpected buffer stack"- [nthBufferRef 1 buffers, nthBufferRef 2 buffers]+ [nthBufferRef 1 bufs, nthBufferRef 2 bufs] (take 2 . NE.toList $ bufferStack editor) runTest setupActions preConditions testActions assertions c@@ -89,15 +89,15 @@ , testCase ":buffer % is a no-op" $ do let setupActions = createInitialBuffers - preConditions editor buffers =- assertCurrentBuffer (nthBufferRef 2 buffers) editor+ preConditions editor bufs =+ assertCurrentBuffer (nthBufferRef 2 bufs) editor testActions _ = ev $ ":buffer %<CR>" - assertions editor buffers = do+ assertions editor bufs = do assertContentOfCurrentBuffer c "Buffer three" editor- assertCurrentBuffer (nthBufferRef 2 buffers) editor+ assertCurrentBuffer (nthBufferRef 2 bufs) editor runTest setupActions preConditions testActions assertions c @@ -105,15 +105,15 @@ , testCase ":buffer is a no-op" $ do let setupActions = createInitialBuffers - preConditions editor buffers =- assertCurrentBuffer (nthBufferRef 2 buffers) editor+ preConditions editor bufs =+ assertCurrentBuffer (nthBufferRef 2 bufs) editor testActions _ = ev $ ":buffer<CR>" - assertions editor buffers = do+ assertions editor bufs = do assertContentOfCurrentBuffer c "Buffer three" editor- assertCurrentBuffer (nthBufferRef 2 buffers) editor+ assertCurrentBuffer (nthBufferRef 2 bufs) editor runTest setupActions preConditions testActions assertions c @@ -121,15 +121,15 @@ , testCase "A modified buffer is not abandoned" $ do let setupActions = createInitialBuffers - preConditions editor buffers =- assertNotCurrentBuffer (nthBufferRef 1 buffers) editor+ preConditions editor bufs =+ assertNotCurrentBuffer (nthBufferRef 1 bufs) editor - testActions buffers = do+ testActions bufs = do withCurrentBuffer $ insertN "The buffer is altered"- ev $ ":buffer " ++ nthBufferName 1 buffers ++ "<CR>"+ ev $ ":buffer " ++ nthBufferName 1 bufs ++ "<CR>" - assertions editor buffers = do- assertNotCurrentBuffer (nthBufferRef 1 buffers) editor+ assertions editor bufs = do+ assertNotCurrentBuffer (nthBufferRef 1 bufs) editor runTest setupActions preConditions testActions assertions c @@ -137,15 +137,15 @@ , testCase "A modified buffer can be abandoned with a bang" $ do let setupActions = createInitialBuffers - preConditions editor buffers =- assertNotCurrentBuffer (nthBufferRef 1 buffers) editor+ preConditions editor bufs =+ assertNotCurrentBuffer (nthBufferRef 1 bufs) editor - testActions buffers = do+ testActions bufs = do withCurrentBuffer $ insertN "The buffer is altered"- ev $ ":buffer! " ++ nthBufferName 1 buffers ++ "<CR>"+ ev $ ":buffer! " ++ nthBufferName 1 bufs ++ "<CR>" - assertions editor buffers = do- assertCurrentBuffer (nthBufferRef 1 buffers) editor+ assertions editor bufs = do+ assertCurrentBuffer (nthBufferRef 1 bufs) editor runTest setupActions preConditions testActions assertions c @@ -153,18 +153,18 @@ , testCase ":Nbuffer switches to the numbered buffer" $ do let setupActions = createInitialBuffers - preConditions editor buffers =- assertNotCurrentBuffer (nthBufferRef 1 buffers) editor+ preConditions editor bufs =+ assertNotCurrentBuffer (nthBufferRef 1 bufs) editor - testActions buffers =+ testActions bufs = -- return ()- let (BufferRef bref) = nthBufferRef 1 buffers+ let (BufferRef bref) = nthBufferRef 1 bufs in ev $ ":" ++ show bref ++ "buffer<CR>" -- in ev $ ":buffer " ++ show bref ++ "<CR>" - assertions editor buffers = do+ assertions editor bufs = do -- assertContentOfCurrentBuffer c "Buffer two" editor- assertCurrentBuffer (nthBufferRef 1 buffers) editor+ assertCurrentBuffer (nthBufferRef 1 bufs) editor runTest setupActions preConditions testActions assertions c
tests/Vim/TestExCommandParsers.hs view
@@ -1,7 +1,6 @@ {-# LANGUAGE OverloadedStrings #-} module Vim.TestExCommandParsers (tests) where -import Control.Applicative import Data.List (inits) import Data.Maybe import Data.Monoid
+ tests/vimtests/sort/6.test view
@@ -0,0 +1,20 @@+-- Input+(1,1)+#pragma once++#include <memory>+#include <future>+#include <string>++namespace stuff {+-- Output+(6,1)+#pragma once++#include <future>+#include <memory>+#include <string>++namespace stuff {+-- Events+jjVjj:sort<CR>
yi-keymap-vim.cabal view
@@ -3,7 +3,7 @@ -- see: https://github.com/sol/hpack name: yi-keymap-vim-version: 0.13.7+version: 0.14.0 synopsis: Vim keymap for Yi editor category: Yi homepage: https://github.com/yi-editor/yi#readme@@ -384,6 +384,7 @@ tests/vimtests/sort/3.test tests/vimtests/sort/4.test tests/vimtests/sort/5.test+ tests/vimtests/sort/6.test tests/vimtests/switchcase/g_capU.test tests/vimtests/switchcase/gtilde.test tests/vimtests/switchcase/gtilde_1.test@@ -531,7 +532,6 @@ Yi.Keymap.Vim.Ex.Commands.Paste Yi.Keymap.Vim.Ex.Commands.Quit Yi.Keymap.Vim.Ex.Commands.Read- Yi.Keymap.Vim.Ex.Commands.Reload Yi.Keymap.Vim.Ex.Commands.Shell Yi.Keymap.Vim.Ex.Commands.Sort Yi.Keymap.Vim.Ex.Commands.Substitute