summaryrefslogtreecommitdiffstats
path: root/test5.hs
diff options
context:
space:
mode:
authortv <tv@shackspace.de>2014-12-30 17:52:39 +0100
committertv <tv@shackspace.de>2014-12-30 17:52:39 +0100
commit19398520536f1e6dda0cc3c6770353d9fe463b7b (patch)
tree6bb004d4a1519cf79443cd66accb06d1c64d0c3c /test5.hs
parent6509114b38272fbb24eb0943a8efb41f7f5660fd (diff)
toggle folds with mouse 2
Diffstat (limited to 'test5.hs')
-rw-r--r--test5.hs13
1 files 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