@@ -5,6 +5,7 @@ open neovim
55
66open Avalonia.Input
77open System
8+ open System.Runtime .InteropServices
89open FSharp.Control .Reactive
910open Avalonia.Interactivity
1011
@@ -94,6 +95,7 @@ let DIR (dx: float, dy: float, horizontal: bool) =
9495
9596let mutable accumulatedX = 0.0
9697let mutable accumulatedY = 0.0
98+ let mutable blockNextTextInput = false
9799
98100// Avoid sending Rejected key as a sequence, e.g. "capslock"
99101let RejectKeys = set [
@@ -285,7 +287,7 @@ let (|Special|Normal|Rejected|) (x: InputEvent) =
285287 // | ' | ' | ä |
286288 // | Ctrl-' | <C-'> | <C-'> |
287289 //
288- | Key( m , Key.Back) -> Special " BS"
290+ | Key(_ , Key.Back) -> Special " BS"
289291 | Key(_, Key.Tab) -> Special " Tab"
290292 | Key(_, Key.LineFeed) -> Special " NL"
291293 | Key(_, Key.Return) -> Special " CR"
@@ -359,8 +361,14 @@ let (|Special|Normal|Rejected|) (x: InputEvent) =
359361 | Key(_, Key.Divide) -> Special( " kDivide" )
360362 | Key(_, Key.Separator) -> Special( " kEnter" )
361363 | Key(_, Key.Decimal) -> Special( " kPoint" )
362- | Key( NoFlag( KeyModifiers.Shift), x) -> Normal ( x.ToString() .ToLowerInvariant())
363- | Key(_, x) -> Normal ( x.ToString())
364+ | Key( NoFlag( KeyModifiers.Shift) as m, x) ->
365+ if RuntimeInformation.IsOSPlatform( OSPlatform.Linux) && m = KeyModifiers.Alt
366+ then blockNextTextInput <- true
367+ Normal ( x.ToString() .ToLowerInvariant())
368+ | Key( m, x) ->
369+ if RuntimeInformation.IsOSPlatform( OSPlatform.Linux) && m = ( KeyModifiers.Alt ||| KeyModifiers.Shift)
370+ then blockNextTextInput <- true
371+ Normal ( x.ToString())
364372 | _ -> Rejected
365373
366374let rec ModifiersPrefix ( x : InputEvent ) =
@@ -398,7 +406,11 @@ let onInput (nvim: Nvim) (input: IObservable<int*InputEvent*RoutedEventArgs>) =
398406 match x with
399407 | TextInput txt ->
400408 ev.Handled <- true
401- if txt = " <" then Some " <LT>" else Some txt
409+ if blockNextTextInput then
410+ blockNextTextInput <- false
411+ None
412+ elif txt = " <" then Some " <LT>"
413+ else Some txt
402414 | InputEvent.Key _ ->
403415 ev.Handled <- true
404416 let pref = ModifiersPrefix x
0 commit comments