[client] Remove microlens dependency
This commit is contained in:
parent
50e78cfed3
commit
0d01e4792d
3 changed files with 3 additions and 6 deletions
|
|
@ -18,7 +18,6 @@ dependencies:
|
||||||
- async
|
- async
|
||||||
- brick
|
- brick
|
||||||
- containers
|
- containers
|
||||||
- microlens
|
|
||||||
- optparse-applicative
|
- optparse-applicative
|
||||||
- safe
|
- safe
|
||||||
- text
|
- text
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,6 @@ import Brick.Widgets.Edit
|
||||||
import qualified Data.Text as T
|
import qualified Data.Text as T
|
||||||
import Data.Text.Zipper
|
import Data.Text.Zipper
|
||||||
import qualified Graphics.Vty as Vty
|
import qualified Graphics.Vty as Vty
|
||||||
import Lens.Micro
|
|
||||||
|
|
||||||
newtype NodeEditor n = NodeEditor (Editor T.Text n)
|
newtype NodeEditor n = NodeEditor (Editor T.Text n)
|
||||||
deriving (Show)
|
deriving (Show)
|
||||||
|
|
@ -43,5 +42,5 @@ renderNodeEditor ne@(NodeEditor e) =
|
||||||
makeVisible $ vLimit height $ renderEditor renderLines True e
|
makeVisible $ vLimit height $ renderEditor renderLines True e
|
||||||
where
|
where
|
||||||
height = length $ getCurrentLines ne
|
height = length $ getCurrentLines ne
|
||||||
(row, col) = cursorPosition $ e ^. editContentsL
|
(row, col) = cursorPosition $ editContents e
|
||||||
makeVisible = visibleRegion (Location (col, row)) (1, 1)
|
makeVisible = visibleRegion (Location (col, row)) (1, 1)
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,6 @@ module Forest.Client.WidgetTree
|
||||||
import Brick
|
import Brick
|
||||||
import qualified Data.Text as T
|
import qualified Data.Text as T
|
||||||
import qualified Graphics.Vty as Vty
|
import qualified Graphics.Vty as Vty
|
||||||
import Lens.Micro
|
|
||||||
|
|
||||||
data WidgetTree n = WidgetTree (Widget n) [WidgetTree n]
|
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
|
-- Construct the Vty image containing the indentation text
|
||||||
height = Vty.imageHeight rightImage
|
height = Vty.imageHeight rightImage
|
||||||
leftLines = firstLine : replicate (height - 1) otherLines
|
leftLines = firstLine : replicate (height - 1) otherLines
|
||||||
leftAttribute = attrMapLookup indentAttrName $ context ^. ctxAttrMapL
|
leftAttribute = attrMapLookup indentAttrName $ ctxAttrMap context
|
||||||
leftImage = Vty.vertCat $ map (Vty.text' leftAttribute) leftLines
|
leftImage = Vty.vertCat $ map (Vty.text' leftAttribute) leftLines
|
||||||
-- Add the indentation text to the left of the result image
|
-- Add the indentation text to the left of the result image
|
||||||
combinedImage = leftImage Vty.<|> image rightResult
|
combinedImage = leftImage Vty.<|> image rightResult
|
||||||
offset = Location (leftWidth, 0)
|
offset = Location (leftWidth, 0)
|
||||||
result = addResultOffset offset rightResult & imageL .~ combinedImage
|
result = (addResultOffset offset rightResult) {image=combinedImage}
|
||||||
pure result
|
pure result
|
||||||
|
|
||||||
indent :: IndentOptions -> [Widget n] -> Widget n
|
indent :: IndentOptions -> [Widget n] -> Widget n
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue