From 19398520536f1e6dda0cc3c6770353d9fe463b7b Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 30 Dec 2014 17:52:39 +0100 Subject: toggle folds with mouse 2 --- test5.hs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/test5.hs b/test5.hs index 3c8b86f..464163b 100644 --- a/test5.hs +++ b/test5.hs @@ -238,10 +238,16 @@ keymap s = \q -> mousemap :: MouseInfo -> State -> IO State +mousemap MouseInfo{mouseButton=1,mouseY=y} = defaultMouse1Click y +mousemap MouseInfo{mouseButton=3,mouseY=y} = \q -> defaultMouse1Click y q >>= toggleFold mousemap MouseInfo{mouseButton=4} = moveTreeDown 3 mousemap MouseInfo{mouseButton=5} = moveTreeUp 3 +mousemap MouseInfo{mouseButton=0} = return +mousemap info = \q -> + return q { flashMessage = SGR [38,5,202] $ Plain $ show info } -mousemap MouseInfo{mouseButton=1,mouseY=y} = \q@State{..} -> do + +defaultMouse1Click y q@State{..} = do let linearClickPos = let i = (y - length headBuffer + yoffset) - 1 {-zero-based-} in if 0 <= i && i < length treeBuffer @@ -257,11 +263,6 @@ mousemap MouseInfo{mouseButton=1,mouseY=y} = \q@State{..} -> do { cursor = findNextN i $ Z.root cursor } -mousemap MouseInfo{mouseButton=0} = return - -mousemap info = \q -> - return q { flashMessage = SGR [38,5,202] $ Plain $ show info } - topOverrun :: State -> Int -- cgit v1.2.3