nix-tree 0.7.0 → 0.8.0
raw patch · 3 files changed
+47/−11 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGELOG.md +10/−3
- app/NixTree/BrickApp.hs +36/−7
- nix-tree.cabal +1/−1
CHANGELOG.md view
@@ -1,5 +1,12 @@ # Changelog +## 0.8.0 - 2025-12-06:++* feat: support jumping to beginning/end of line (Home/End keys) in why-depends modal (thanks @jhrcek+, PR [#132]))++[#132]: https://github.com/utdemir/nix-tree/pull/132+ ## 0.7.0 - 2025-10-13: * feat: Now available as a Haskell library (thanks @MangoIV (issue: [#84]), @blackheaven (PR: [#129]))@@ -60,7 +67,7 @@ ## 0.3.3 - 2024-01-17: -* chore: Update 'brick' & 'optparse-applicative' library to work with the newer Stackage snapshot (thanks @ncfavier, PR: [#78][]) +* chore: Update 'brick' & 'optparse-applicative' library to work with the newer Stackage snapshot (thanks @ncfavier, PR: [#78][]) [#78]: https://github.com/utdemir/nix-tree/issues/78 @@ -73,14 +80,14 @@ ## 0.3.1 - 2022-12-10: -* fix: Update 'brick' library (thanks @ncfavier, PR: [#47][]) +* fix: Update 'brick' library (thanks @ncfavier, PR: [#47][]) [#47]: https://github.com/utdemir/nix-tree/issues/47 ## 0.3.0 - 2022-11-26: * feat: Improved help text.-* feat: Allow passing '--impure' flag to Nix (issue: [#40][]) +* feat: Allow passing '--impure' flag to Nix (issue: [#40][]) * fix: Use -O1 instead of -O2 to save on compile times. [#40]: https://github.com/utdemir/nix-tree/issues/40
app/NixTree/BrickApp.hs view
@@ -12,7 +12,7 @@ import qualified Data.Set as Set import qualified Data.Text as T import qualified Graphics.Vty as V-import Lens.Micro (Traversal', _Just)+import Lens.Micro (Traversal', _1, _Just, (^.)) import qualified NixTree.Clipboard as Clipboard import NixTree.Data.InvertedIndex import NixTree.PathStats@@ -258,6 +258,12 @@ (B.VtyEvent (V.EvKey k []), Just (ModalWhyDepends _)) | k `elem` [V.KChar 'l', V.KRight] -> B.hScrollBy (B.viewportScroll WidgetWhyDependsViewport) 1+ (B.VtyEvent (V.EvKey k []), Just (ModalWhyDepends _))+ | k == V.KHome ->+ B.hScrollToBeginning (B.viewportScroll WidgetWhyDependsViewport)+ (B.VtyEvent (V.EvKey k []), Just (ModalWhyDepends l))+ | k == V.KEnd ->+ scrollToSelectedLineEnd l (B.VtyEvent (V.EvKey V.KPageUp []), Just (ModalWhyDepends _)) -> B.zoom (aeOpenModalL . _Just . _ModalWhyDepends) B.listMovePageUp (B.VtyEvent (V.EvKey V.KPageDown []), Just (ModalWhyDepends _)) ->@@ -448,12 +454,35 @@ & renderModal "why-depends" where renderDepends _ =- B.txt . pathsToText- pathsToText xs =- xs- & NE.toList- & fmap (storeNameToShortText . spName)- & T.intercalate " → "+ B.txt . whyDependsPathToText++whyDependsPathToText :: NonEmpty Path -> Text+whyDependsPathToText xs =+ xs+ & NE.toList+ & fmap (storeNameToShortText . spName)+ & T.intercalate " → "++{- We could use 'B.hScrollToEnd', but it jumps too much when some lines are longer than others.+This is more fine grained in that it jumps only to the end of the currently selected line.+-}+scrollToSelectedLineEnd ::+ B.GenericList Widgets Seq (NonEmpty Path) ->+ B.EventM Widgets (AppEnv s) ()+scrollToSelectedLineEnd l = do+ mViewport <- B.lookupViewport WidgetWhyDependsViewport+ case (mViewport, B.listSelectedElement l) of+ (Just vp, Just (_, selectedPath')) -> do+ let textWidth = B.textWidth (whyDependsPathToText selectedPath')+ viewportWidth = vp ^. B.vpSize . _1+ currentScroll = vp ^. B.vpLeft+ -- Calculate the scroll position needed to right-align the selected line+ -- We want: scrollPos + viewportWidth >= textWidth+ -- So: scrollPos = textWidth - viewportWidth (but not less than 0)+ targetScroll = max 0 (textWidth - viewportWidth)+ scrollDelta = targetScroll - currentScroll+ B.hScrollBy (B.viewportScroll WidgetWhyDependsViewport) scrollDelta+ _ -> pass showWhyDepends :: AppEnv s -> AppEnv s showWhyDepends env@AppEnv {aeActualStoreEnv} =
nix-tree.cabal view
@@ -3,7 +3,7 @@ name: nix-tree synopsis: Interactively browse a Nix store paths dependencies description: A terminal curses application to browse a Nix store paths dependencies-version: 0.7.0+version: 0.8.0 homepage: https://github.com/utdemir/nix-tree license: BSD-3-Clause license-file: LICENSE