diff options
Diffstat (limited to '')
| -rw-r--r-- | lib/Daffm/View.hs | 14 | ||||
| -rw-r--r-- | notes.org | 18 |
2 files changed, 20 insertions, 12 deletions
diff --git a/lib/Daffm/View.hs b/lib/Daffm/View.hs index e65a13a..da6a11b 100644 --- a/lib/Daffm/View.hs +++ b/lib/Daffm/View.hs @@ -1,7 +1,7 @@ module Daffm.View where -import Brick.Types (Widget) -import Brick.Widgets.Core (Padding (Max, Pad), emptyWidget, hBox, hLimit, padLeft, padRight, str, txt, vBox, vLimit, withAttr, (<+>)) +import Brick.Types (Context (availWidth), Size (Fixed), Widget (Widget, render), getContext) +import Brick.Widgets.Core (Padding (Max, Pad), TextWidth (textWidth), emptyWidget, hBox, hLimit, padLeft, padRight, str, txt, vBox, vLimit, withAttr, (<+>)) import Brick.Widgets.Edit (renderEditor) import qualified Brick.Widgets.List as L import Daffm.Attrs (directoryAttr, directoryLinkAttr, directorySelectedAttr, fileAttr, fileSelectedAttr, invalidLinkAttr, linkAttr, searchMarchAttr) @@ -27,7 +27,15 @@ hFixed :: Int -> Widget n -> Widget n hFixed w = hLimit w . padRight Max headerView :: AppState -> Widget n -headerView (AppState {stateCwd}) = txt stateCwd +headerView (AppState {stateCwd}) = Widget Fixed Fixed $ do + c <- getContext + let width = availWidth c - 2 -- with padding + render . toWidget . trunc width $ stateCwd + where + toWidget = padLeft (Pad 1) . padRight (Pad 1) . txt + trunc width text + | width < textWidth text = "…" <> Text.takeEnd (width - 1) text + | otherwise = Text.takeEnd width text fileItemView :: AppState -> Int -> Bool -> FileInfo -> Widget FocusTarget fileItemView appState index sel fileInfo@(FileInfo {filePath, fileSize, fileType, fileMode}) = @@ -31,19 +31,19 @@ - [X] Command: search, search-next, search-prev - [X] cd into dir symlinks - [X] Command: map -- [ ] theme from config -- [ ] shorten/trim from left in header for long paths -- [ ] cmdline tab completion +- [X] shorten/trim from left in header for long paths - [ ] Allow escaping % in commands - [ ] Cmdline history - [ ] Store last directory path (for auto cd in shell) -- [ ] Store selections path (for copy/move/paste across instances) -- [ ] Rethink % substituions - [ ] Preserve back directory when going inside sym link to directories ** Later -- [ ] Fix keymap evaluation? (If vd is bound, it doesnt evaluate a v binding) +- [ ] Rethink % substituions +- [ ] cmdline tab completion +- [ ] theme from config +- [ ] Fix keymap evaluation with timeout? (If vd is bound, it doesnt evaluate a v binding) - [ ] Allow escaping % in commands -- [ ] watch for changes -- [ ] bind command: define keybindings +- [ ] Custom commands +- [ ] aliases for builtin commands - [ ] some caching for file list? -- [ ] Command aliases +- [ ] copy/move/paste across instances? +- [ ] watch for changes? |
