Permalink
Browse files

Add rules for keypad keys with Ctrl

Tested with xterm (full success) and rxvt (Home, End and Ins have the same
codes with Ctrl, to be being with, but other keys are OK now).
  • Loading branch information...
Mikolaj committed Mar 2, 2012
1 parent eb390a8 commit d01c8638df78bd76870cc473acee4a1e257ad4e7
Showing with 6 additions and 2 deletions.
  1. +6 −2 src/Graphics/Vty/LLInput.hs
@@ -165,18 +165,22 @@ initTermInput escDelay terminal = do
, k "E" KBegin
],
- -- Support for arrows
+ -- Support for arrows and KHome/KEnd
[("\ESC[" ++ charCnt ++ show mc++c,(s,m))
| charCnt <- ["1;", ""], -- we can have a count or not
(m,mc) <- [([MShift],2::Int), ([MCtrl],5), ([MMeta],3),
([MShift, MCtrl],6), ([MShift, MMeta],4)], -- modifiers and their codes
- (c,s) <- [("A", KUp), ("B", KDown), ("C", KRight), ("D", KLeft)] -- directions and their codes
+ (c,s) <- [("A", KUp), ("B", KDown), ("C", KRight), ("D", KLeft), ("H", KHome), ("F", KEnd)] -- directions and their codes
],
let k n s = ("\ESC["++show n++"~",(s,[]))
in zipWith k [2::Int,3,5,6,1,4]
[KIns,KDel,KPageUp,KPageDown,KHome,KEnd],
+ let k n s = ("\ESC["++show n++";5~",(s,[MCtrl]))
+ in zipWith k [2::Int,3,5,6,1,4]
+ [KIns,KDel,KPageUp,KPageDown,KHome,KEnd],
+
-- Support for simple characters.
[ (x:[],(KASCII x,[])) | x <- map toEnum [0..255] ],

0 comments on commit d01c863

Please sign in to comment.