diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/desktop-pager.hs | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/desktop-pager.hs b/src/desktop-pager.hs index 0a03c66..830b32e 100644 --- a/src/desktop-pager.hs +++ b/src/desktop-pager.hs @@ -3,7 +3,7 @@ {-# LANGUAGE ViewPatterns #-} module Main (main) where -import Blessings.Text (Blessings(Plain,SGR),pp) +import Blessings (Blessings(Plain,SGR),pp) import Control.Concurrent import Control.Monad (forM) import Control.Monad (forever) @@ -13,6 +13,7 @@ import Data.Function ((&)) import Data.List.Extra ((!!?)) import Data.Maybe (catMaybes,fromMaybe) import Data.Monoid.Extra (mintercalate) +import Data.Sequences qualified as S import Data.Set (Set) import Data.Text (Text) import Much.Screen (Screen(Screen), withScreen) @@ -22,7 +23,6 @@ import State (State(..)) import System.Environment (getArgs) import System.IO import System.Posix.Signals (Handler(Catch), Signal, installHandler, sigINT) -import qualified Blessings.Internal as Blessings import qualified Data.Char as Char import qualified Data.List as List import qualified Data.Map as Map @@ -521,36 +521,36 @@ redraw o q@State{..} = do paddingRight = 10 eraseRight2 s = - if Blessings.length s < maxWidth then - s <> SGR [38,5,234] (Plain $ Text.pack $ replicate (maxWidth - Blessings.length s) '@') + if S.lengthIndex s < maxWidth then + s <> SGR [38,5,234] (Plain $ Text.pack $ replicate (maxWidth - S.lengthIndex s) '@') else s render0 :: State -> [Blessings Text] render0 q@State{..} = - map (Blessings.take maxWidth) ((shownWorkspacesPadding <> shownWorkspaces) `join` (shownWindowsPadding <> fromMaybe mempty shownWindows)) <> + map (S.take maxWidth) ((shownWorkspacesPadding <> shownWorkspaces) `join` (shownWindowsPadding <> fromMaybe mempty shownWindows)) <> [prompt <> inputLine] <> [statusLine] where prompt = SGR [38,5,147] "> " - inputLine = Blessings.take (maxWidth - Blessings.length prompt) (renderBuffer q) + inputLine = S.take (maxWidth - S.lengthIndex prompt) (renderBuffer q) statusLine = ls <> sp <> rs where - ln = Blessings.length ls + ln = S.lengthIndex ls ls = - (Blessings.take termWidth + (S.take termWidth (SGR [38,5,242] flashMessage <> Plain (Text.show count))) sn = termWidth - ln - rn sp = (SGR [38,5,234] $ Plain $ Text.pack $ replicate sn '#') - rn = Blessings.length rs + rn = S.lengthIndex rs rs = case command of ViewWorkspace -> SGR [38,5,236] "view" @@ -625,11 +625,11 @@ join :: [Blessings Text] -> [Blessings Text] -> [Blessings Text] join ls rs = zipWith (<>) lsFilled rs where - lsWidth = maximum $ map Blessings.length ls + lsWidth = maximum $ map S.lengthIndex ls lsFilled = map (lsFill lsWidth) ls lsFill n s = - if Blessings.length s < n then - s <> SGR [38,5,234] (Plain (Text.pack (replicate (n - Blessings.length s) '#') <> Text.singleton '|')) + if S.lengthIndex s < n then + s <> SGR [38,5,234] (Plain (Text.pack (replicate (n - S.lengthIndex s) '#') <> Text.singleton '|')) else s <> SGR [38,5,234] (Plain (Text.singleton '|')) |
