diff options
author | tv <tv@shackspace.de> | 2014-12-28 03:58:41 +0100 |
---|---|---|
committer | tv <tv@shackspace.de> | 2014-12-28 03:58:41 +0100 |
commit | 4c1239c2e846d8f1987257e1fc76232ec295804f (patch) | |
tree | f1d44a48ab4114781e78c68d5fa8b16b27fab6da /test4.hs | |
parent | 9edccfb36aa2d266d6f8038f6195c78697b3d0be (diff) |
moveToParent with backspace (\DEL)
Diffstat (limited to 'test4.hs')
-rw-r--r-- | test4.hs | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -160,6 +160,7 @@ keymap "\ESC[b" = Just $ moveTreeUp 1 keymap "\ESC[5~" = Just $ \q -> moveTreeDown (screenHeight q `div` 2) q -- PgUp keymap "\ESC[6~" = Just $ \q -> moveTreeUp (screenHeight q `div` 2) q -- PgDn keymap "\n" = Just toggleFold +keymap "\DEL" = Just moveToParent -- backspace keymap ('\ESC':'[':'9':';':xs) = Just $ \q@State{..} -> do let (h,';':w) = break (==';') (take (length xs - 1) xs) -- ^ drop (assumed) trailing 't' @@ -213,6 +214,15 @@ moveTreeDown n q@State{..} = i -> moveCursorUp i q' +moveToParent q@State{..} = + case Z.parent cursor of + Nothing -> return q { flashMessage = "cannot go further up" } + Just cursor' -> + let q' = q { cursor = cursor' } + in case topOverrun q' of + 0 -> return q' + i -> moveTreeDown i q' + toggleFold :: State -> IO State toggleFold q@State{..} = case Z.label cursor of |