Skip to content

Commit

Permalink
fix #45
Browse files Browse the repository at this point in the history
  • Loading branch information
Yatao Li committed Aug 11, 2019
1 parent b2c13aa commit 6b4c309
Showing 1 changed file with 12 additions and 15 deletions.
27 changes: 12 additions & 15 deletions neovim/neovim.model.fs
Original file line number Diff line number Diff line change
Expand Up @@ -110,28 +110,25 @@ module ModelImpl =

let DIR (dx: float, dy: float, horizontal: bool) =
match sign dx, sign dy, horizontal with
| -1, _, true -> "Right"
| -1, _, true -> "Right"
| _, _, true -> "Left"
| _, -1, false -> "Down"
| _, _, false -> "Up"
let suffix (suf: string, r: int, c: int) =
sprintf "%s><%d,%d" suf r c
let (|Repeat|Special|Normal|ImeEvent|TextInput|Unrecognized|) (x: InputEvent) =
match x with
| Key(_, Key.Back)
| Key(HasFlag(InputModifiers.Control), Key.H) -> Special "BS"
| Key(_, Key.Tab)
| Key(HasFlag(InputModifiers.Control), Key.I) -> Special "Tab"
| Key(_, Key.LineFeed)
| Key(HasFlag(InputModifiers.Control), Key.J) -> Special "NL"
(*
| Key(HasFlag(InputModifiers.Control), Key.L) -> Special "FF"
^^^ Note: if ^L is sent as <FF> then neovim discards the key.
*)
| Key(_, Key.Return)
| Key(HasFlag(InputModifiers.Control), Key.M) -> Special "CR"
| Key(_, Key.Escape)
| Key(HasFlag(InputModifiers.Control), Key.Oem4) -> Special "Esc"
// | Key(HasFlag(InputModifiers.Control), Key.H)
// | Key(HasFlag(InputModifiers.Control), Key.J)
// | Key(HasFlag(InputModifiers.Control), Key.I)
// | Key(HasFlag(InputModifiers.Control), Key.M)
// | Key(HasFlag(InputModifiers.Control), Key.Oem4) // Oem4 is '['
// | Key(HasFlag(InputModifiers.Control), Key.L) // if ^L is sent as <FF> then neovim discards the key.
| Key(_, Key.Back) -> Special "BS"
| Key(_, Key.Tab) -> Special "Tab"
| Key(_, Key.LineFeed) -> Special "NL"
| Key(_, Key.Return) -> Special "CR"
| Key(_, Key.Escape) -> Special "Esc"
| Key(_, Key.Space) -> Special "Space"
| Key(HasFlag(InputModifiers.Shift), Key.OemComma) -> Special "LT"
// note, on Windows '\' is recognized as OemPipe but on macOS it's OemBackslash
Expand Down

0 comments on commit 6b4c309

Please sign in to comment.