Пример #1
0
        public TerminalBox(StreamReader input, TextWriter output)
        {
            this.input  = input;
            this.output = output;

            events = new InputEventEmitter(this);
            map    = new InputMapper();

            var keys = new KeysMap(events);

            keys.Register(map);

            var x10 = new X10MouseEncoding(events);

            x10.Register(map);

            var mencode = new ExtendedMouseModeEncoding(events);

            mencode.Register(map);

            // TODO Something is funky with encoding on win
            // sometimes the mouse events show up as \x1b\0[\0 etc...  funky \0 between each character
            // this would generally mean the encoding is punked, but it's fine most of the time.
            // might require manual parsing... ascii sometimes, double byte other times...
            // that's how termbox-go is handling it
            // for now, just going to forcibly ignore bad escapes
            map.Add("\x1b\0", (buf) => buf.Count); // eats it all if it's mangled
        }
Пример #2
0
 public void Register(InputMapper map)
 {
     foreach (var kvp in Keys)
     {
         map.Add(kvp.Key, (buf) =>
         {
             emit.OnKey(kvp.Value);
             return(kvp.Key.Length);
         });
     }
 }
Пример #3
0
 public void Register(InputMapper mapper)
 {
     mapper.Add(PREFIX, Process);
 }