vimus 0.2.0 → 0.2.1
raw patch · 7 files changed
+31/−47 lines, 7 filesdep +time-locale-compatnew-uploader
Dependencies added: time-locale-compat
Files
- ncursesw/src/Curses.chs +3/−9
- ncursesw/src/Misc.chs +2/−11
- src/Option.hs +10/−0
- src/Vimus/Command.hs +9/−23
- src/Vimus/Key.hs +2/−1
- src/Vimus/Type.hs +3/−2
- vimus.cabal +2/−1
ncursesw/src/Curses.chs view
@@ -68,19 +68,18 @@ import Foreign.C.Types-import Foreign.C.String hiding (withCString) import Foreign.Ptr (Ptr, castPtr)-import Foreign.C.String (CString)+import Foreign.C.String (CString, CWString, newCWString) import Foreign.Marshal.Alloc (alloca) import Foreign.Storable (peek)-import Data.Char (chr, ord)+import Data.Char (ord) import Foreign.Marshal.Utils (toBool, fromBool) import Data.ByteString.UTF8 as UTF8 import Data.ByteString.Char8 as Char8 -import Misc hiding (cFromBool)+import Misc import CursesUtil import UI.Curses.Key import CursesInput@@ -203,11 +202,6 @@ #endc stdscr :: Window stdscr = {#call pure get_stdscr#}----cFromBool = fromBool- ------------------------------------------------------------------------ -- inopts(3NCURSES)
ncursesw/src/Misc.chs view
@@ -1,17 +1,13 @@+{-# OPTIONS_GHC -fno-warn-missing-signatures #-} {-# LANGUAGE ForeignFunctionInterface #-} module Misc where import Foreign.C.Types import Foreign.Ptr-import Foreign.C.String-import Foreign.Marshal.Alloc-import Foreign.Storable-import Foreign.ForeignPtr+import Foreign.Marshal.Utils (toBool) -import Data.Char import Data.List (foldl')-import Foreign.Marshal.Utils (fromBool, toBool) import Data.Bits @@ -23,11 +19,6 @@ -- import Foreign.Storable #include "mycurses.h"----cFromBool = fromBool-cToBool = toBool ------------------------------------------------------------------------ -- attr
src/Option.hs view
@@ -1,5 +1,8 @@ module Option (getOptions) where +import Paths_vimus (version)+import Data.Version (showVersion)+ import Data.Maybe import Data.List import Control.Monad@@ -10,6 +13,7 @@ import System.Console.GetOpt data Option = Help+ | Version | IgnoreVimusrc | OptionHost String | OptionPort String@@ -34,6 +38,7 @@ options :: [OptDescr Option] options = [ Option [] ["help"] (NoArg Help ) "Display this help and exit."+ , Option [] ["version"] (NoArg Version ) "Display version and exit." , Option ['h'] ["host"] (ReqArg OptionHost "HOST") hostHelp , Option ['p'] ["port"] (ReqArg OptionPort "PORT") portHelp , Option [] ["ignore-vimusrc"] (NoArg IgnoreVimusrc ) "Do not source ~/.vimusrc on startup."@@ -48,6 +53,11 @@ when (Help `elem` opts) $ do progName <- getProgName putStr $ usageInfo (printf "Usage: %s [options]\n\nOPTIONS" progName) options+ exitSuccess++ when (Version `elem` opts) $ do+ progName <- getProgName+ putStrLn (progName ++ " " ++ showVersion version) exitSuccess unless (null errors) $
src/Vimus/Command.hs view
@@ -488,10 +488,10 @@ , command "set-library-path" "While MPD knows where your songs are stored, vimus doesn't. If you want to use the *%* feature of the command :! you need to tell vimus where your songs are stored." $ do \(Path p) -> setLibraryPath p - , command "next" "stop playing the current song, and starts the next one" $ do+ , command "next" "play the next song" $ do MPD.next :: Vimus () - , command "previous" "stop playing the current song, and starts the previous one" $ do+ , command "previous" "play the previous song" $ do MPD.previous :: Vimus () , command "toggle" "toggle between play and pause" $ do@@ -500,10 +500,10 @@ , command "stop" "stop playback" $ do MPD.stop :: Vimus () - , command "update" "tell MPD to update the music database. You must update your database when you add or delete files in your music directory, or when you edit the metadata of a song. MPD will only rescan a file already in the database if its modification time has changed." $ do+ , command "update" "update music database" $ do void (MPD.update Nothing) :: Vimus () - , command "rescan" "" $ do+ , command "rescan" "recreate the music database" $ do void (MPD.rescan Nothing) :: Vimus () , command "clear" "delete all songs from the playlist" $ do@@ -546,7 +546,6 @@ , command "novisual" "cancel visual selection" $ sendEventCurrent EvNoVisual - -- Remove current song from playlist , command "remove" "remove the song under the cursor from the playlist" $ sendEventCurrent EvRemove @@ -562,28 +561,15 @@ , command "shuffle" "shuffle the current playlist" $ do MPD.shuffle Nothing :: Vimus () - , command "add" "append selected songs to the end of the playlist" $ do+ , command "add" "append selected songs to the current playlist" $ do sendEventCurrent EvAdd - -- insert a song right after the current song- , command "insert" [help|- inserts a song to the playlist. The song is inserted after the currently- playing song.- |] $ do- st <- MPD.status- case MPD.stSongPos st of- Just n -> do- -- there is a current song, insert after- sendEventCurrent (EvInsert (n + 1))- _ -> do- -- there is no current song, just add- sendEventCurrent EvAdd+ , command "insert" "insert a song after the currently playing song" $ do+ maybe (sendEventCurrent EvAdd)+ (sendEventCurrent . EvInsert . succ) . MPD.stSongPos =<< MPD.status - -- Playlist: play selected song- -- Library: add song to playlist and play it- -- Browse: either add song to playlist and play it, or :move-in , command "default-action" [help|- depending on the item under the cursor, somthing different happens:+ context-dependent default action: - *Playlist* start playing the song under the cursor
src/Vimus/Key.hs view
@@ -145,7 +145,8 @@ -- | Replace all special keys with their corresponding key reference. -- -- Vim's key-notation is used for key references.-unExpandKeys = foldr f ""+unExpandKeys :: String -> String+unExpandKeys = foldr f ("" :: String) where f c -- escape opening brackets..
src/Vimus/Type.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE GeneralizedNewtypeDeriving, ExistentialQuantification #-}+{-# LANGUAGE GeneralizedNewtypeDeriving, ExistentialQuantification, FlexibleContexts #-} {-# OPTIONS_GHC -fno-warn-unused-do-bind #-} module Vimus.Type ( Vimus@@ -73,7 +73,8 @@ import Data.Default import Data.Time (formatTime, getZonedTime)-import System.Locale (defaultTimeLocale)+--import System.Locale (defaultTimeLocale)+import Data.Time.Locale.Compat(defaultTimeLocale) import Network.MPD.Core import Network.MPD as MPD (LsResult)
vimus.cabal view
@@ -1,5 +1,5 @@ name: vimus-version: 0.2.0+version: 0.2.1 synopsis: An MPD client with vim-like key bindings description: An MPD client with vim-like key bindings .@@ -52,6 +52,7 @@ , directory , data-default , template-haskell+ , time-locale-compat hs-source-dirs: src , ncursesw/src