From 0d01e4792dc790d3a91df4cb1bf69ba18b9b762e Mon Sep 17 00:00:00 2001 From: Joscha Date: Fri, 28 Feb 2020 19:01:37 +0000 Subject: [PATCH] [client] Remove microlens dependency --- package.yaml | 1 - src/Forest/Client/NodeEditor.hs | 3 +-- src/Forest/Client/WidgetTree.hs | 5 ++--- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/package.yaml b/package.yaml index 0d6dcdc..4d171c7 100644 --- a/package.yaml +++ b/package.yaml @@ -18,7 +18,6 @@ dependencies: - async - brick - containers -- microlens - optparse-applicative - safe - text diff --git a/src/Forest/Client/NodeEditor.hs b/src/Forest/Client/NodeEditor.hs index aae8142..261ac4c 100644 --- a/src/Forest/Client/NodeEditor.hs +++ b/src/Forest/Client/NodeEditor.hs @@ -13,7 +13,6 @@ import Brick.Widgets.Edit import qualified Data.Text as T import Data.Text.Zipper import qualified Graphics.Vty as Vty -import Lens.Micro newtype NodeEditor n = NodeEditor (Editor T.Text n) deriving (Show) @@ -43,5 +42,5 @@ renderNodeEditor ne@(NodeEditor e) = makeVisible $ vLimit height $ renderEditor renderLines True e where height = length $ getCurrentLines ne - (row, col) = cursorPosition $ e ^. editContentsL + (row, col) = cursorPosition $ editContents e makeVisible = visibleRegion (Location (col, row)) (1, 1) diff --git a/src/Forest/Client/WidgetTree.hs b/src/Forest/Client/WidgetTree.hs index 13eb20d..aaeb102 100644 --- a/src/Forest/Client/WidgetTree.hs +++ b/src/Forest/Client/WidgetTree.hs @@ -14,7 +14,6 @@ module Forest.Client.WidgetTree import Brick import qualified Data.Text as T import qualified Graphics.Vty as Vty -import Lens.Micro data WidgetTree n = WidgetTree (Widget n) [WidgetTree n] @@ -30,12 +29,12 @@ indentWith indentAttrName firstLine otherLines wrapped = -- Construct the Vty image containing the indentation text height = Vty.imageHeight rightImage leftLines = firstLine : replicate (height - 1) otherLines - leftAttribute = attrMapLookup indentAttrName $ context ^. ctxAttrMapL + leftAttribute = attrMapLookup indentAttrName $ ctxAttrMap context leftImage = Vty.vertCat $ map (Vty.text' leftAttribute) leftLines -- Add the indentation text to the left of the result image combinedImage = leftImage Vty.<|> image rightResult offset = Location (leftWidth, 0) - result = addResultOffset offset rightResult & imageL .~ combinedImage + result = (addResultOffset offset rightResult) {image=combinedImage} pure result indent :: IndentOptions -> [Widget n] -> Widget n