matterhorn 90000.1.0 → 90000.1.1
raw patch · 6 files changed
+56/−44 lines, 6 filesdep ~mattermost-api
Dependency ranges changed: mattermost-api
Files
- CHANGELOG.md +7/−0
- matterhorn.cabal +2/−2
- src/Matterhorn/App.hs +45/−35
- src/Matterhorn/Clipboard.hs +1/−1
- src/Matterhorn/State/UserListWindow.hs +1/−1
- src/Matterhorn/Types.hs +0/−5
CHANGELOG.md view
@@ -1,4 +1,11 @@ +90000.1.1+=========++Bug fixes:+* Matterhorn now allows the client configuration's+ `EnableSignUpWithGitLab` to be omitted. (#852)+ 90000.1.0 =========
matterhorn.cabal view
@@ -1,5 +1,5 @@ name: matterhorn-version: 90000.1.0+version: 90000.1.1 synopsis: Terminal client for the Mattermost chat system description: This is a terminal client for the Mattermost chat system. Please see the README for a list of@@ -170,7 +170,7 @@ ghc-options: -fhide-source-paths build-depends: base >=4.8 && <5- , mattermost-api == 90000.0.0+ , mattermost-api == 90000.1.1 , base-compat >= 0.9 && < 0.13 , unordered-containers >= 0.2 && < 0.3 , containers >= 0.5.7 && < 0.7
src/Matterhorn/App.hs view
@@ -7,7 +7,7 @@ import Prelude () import Matterhorn.Prelude -import Brick+import qualified Brick as B import Control.Monad.Trans.Except ( runExceptT ) import qualified Control.Exception as E import qualified Graphics.Vty as Vty@@ -30,21 +30,21 @@ import Matterhorn.Types -app :: App ChatState MHEvent Name+app :: B.App ChatState MHEvent Name app =- App { appDraw = draw- , appHandleEvent = Events.onEvent- , appAttrMap = (^.csResources.crTheme)- , appChooseCursor = \s cs -> do- tId <- s^.csCurrentTeamId- cursorByMode cs s tId (teamMode $ s^.csTeam(tId))- , appStartEvent = do- vty <- getVtyHandle- (w, h) <- liftIO $ Vty.displayBounds $ Vty.outputIface vty- runMHEvent $ Events.setWindowSize w h- }+ B.App { B.appDraw = draw+ , B.appHandleEvent = Events.onEvent+ , B.appAttrMap = (^.csResources.crTheme)+ , B.appChooseCursor = \s cs -> do+ tId <- s^.csCurrentTeamId+ cursorByMode cs s tId (teamMode $ s^.csTeam(tId))+ , B.appStartEvent = do+ vty <- B.getVtyHandle+ (w, h) <- liftIO $ Vty.displayBounds $ Vty.outputIface vty+ runMHEvent $ Events.setWindowSize w h+ } -cursorByMode :: [CursorLocation Name] -> ChatState -> TeamId -> Mode -> Maybe (CursorLocation Name)+cursorByMode :: [B.CursorLocation Name] -> ChatState -> TeamId -> Mode -> Maybe (B.CursorLocation Name) cursorByMode cs s tId mode = case mode of Main -> case s^.csTeam(tId).tsMessageInterfaceFocus of@@ -52,24 +52,24 @@ cId <- s^.csCurrentChannelId(tId) mi <- s^?maybeChannelMessageInterface(cId) cur <- messageInterfaceCursor mi- showCursorNamed cur cs+ B.showCursorNamed cur cs FocusThread -> do ti <- s^.csTeam(tId).tsThreadInterface cur <- messageInterfaceCursor ti- showCursorNamed cur cs+ B.showCursorNamed cur cs LeaveChannelConfirm -> Nothing DeleteChannelConfirm -> Nothing MessageSelectDeleteConfirm {} -> Nothing- (PostListWindow {}) -> Nothing+ PostListWindow {} -> Nothing ViewMessage -> Nothing- (ShowHelp {}) -> Nothing+ ShowHelp {} -> Nothing EditNotifyPrefs -> Nothing- ChannelSelect -> showFirstCursor s cs- UserListWindow -> showFirstCursor s cs- ReactionEmojiListWindow -> showFirstCursor s cs- ChannelListWindow -> showFirstCursor s cs- ThemeListWindow -> showFirstCursor s cs- ChannelTopicWindow -> showCursorNamed (ChannelTopicEditor tId) cs+ ChannelSelect -> B.showFirstCursor s cs+ UserListWindow -> B.showFirstCursor s cs+ ReactionEmojiListWindow -> B.showFirstCursor s cs+ ChannelListWindow -> B.showFirstCursor s cs+ ThemeListWindow -> B.showFirstCursor s cs+ ChannelTopicWindow -> B.showCursorNamed (ChannelTopicEditor tId) cs applicationMaxCPUs :: Int applicationMaxCPUs = 2@@ -93,22 +93,32 @@ Vty.installUnicodeWidthTable wMap `E.catch` (\(_::Vty.TableInstallException) -> return ()) +vtyModes :: Config -> [(Vty.Mode, Bool)]+vtyModes config =+ [ (Vty.BracketedPaste, True)+ , (Vty.Hyperlink, configHyperlinkingMode config)+ , (Vty.Mouse, configMouseMode config)+ ]++vtyBuilder :: Config -> IO Vty.Vty+vtyBuilder config = do+ vty <- Vty.mkVty Vty.defaultConfig+ let output = Vty.outputIface vty++ forM_ (vtyModes config) $ \(mode, val) ->+ Vty.setMode output mode val++ return vty+ runMatterhorn :: Options -> Config -> IO ChatState runMatterhorn opts config = do setupCpuUsage config- setupCharWidthMap config - let mkVty = do- vty <- Vty.mkVty Vty.defaultConfig- let output = Vty.outputIface vty- Vty.setMode output Vty.BracketedPaste True- Vty.setMode output Vty.Hyperlink $ configHyperlinkingMode config- Vty.setMode output Vty.Mouse $ configMouseMode config- return vty+ let builder = vtyBuilder config - (st, vty) <- setupState mkVty (optLogLocation opts) config- finalSt <- customMain vty mkVty (Just $ st^.csResources.crEventQueue) app st+ (st, vty) <- setupState builder (optLogLocation opts) config+ finalSt <- B.customMain vty builder (Just $ st^.csResources.crEventQueue) app st case st^.csResources.crSpellChecker of Nothing -> return ()@@ -132,7 +142,7 @@ where logIfError action msg = do- done <- runExceptT $ convertIOException $ action+ done <- runExceptT $ convertIOException action case done of Left err -> putStrLn $ msg <> ": " <> err Right _ -> return ()
src/Matterhorn/Clipboard.hs view
@@ -15,7 +15,7 @@ copyToClipboard :: Text -> MH () copyToClipboard txt = do- result <- liftIO (try (setClipboard (T.unpack txt)))+ result <- liftIO $ try $ setClipboard $ T.unpack txt case result of Left e -> do let errMsg = case e of
src/Matterhorn/State/UserListWindow.hs view
@@ -66,7 +66,7 @@ enterDMSearchUserList myTId = do myId <- gets myUserId config <- use csClientConfig- let restrictTeam = case MM.clientConfigRestrictDirectMessage <$> config of+ let restrictTeam = case MM.clientConfigRestrictDirectMessage =<< config of Just MM.RestrictTeam -> Just myTId _ -> Nothing enterUserListMode myTId (AllUsers restrictTeam) Nothing
src/Matterhorn/Types.hs view
@@ -351,8 +351,6 @@ , getEditedMessageCutoff , HighlightSet(..)- , UserSet- , ChannelSet , getHighlightSet , emptyHSet @@ -2166,9 +2164,6 @@ getUsers = use csUsers -- * HighlightSet--type UserSet = Set Text-type ChannelSet = Set Text -- | The set of usernames, channel names, and language names used for -- highlighting when rendering messages.