Example #1
0
        public LineEditor(string name, int histsize)
        {
            handlers = new Handler [] {
                new Handler(ConsoleKey.Home, CmdHome),
                new Handler(ConsoleKey.End, CmdEnd),
                new Handler(ConsoleKey.LeftArrow, CmdLeft),
                new Handler(ConsoleKey.RightArrow, CmdRight),
                new Handler(ConsoleKey.UpArrow, CmdHistoryPrev),
                new Handler(ConsoleKey.DownArrow, CmdHistoryNext),
                new Handler(ConsoleKey.Enter, CmdDone),
                new Handler(ConsoleKey.Backspace, CmdBackspace),
                new Handler(ConsoleKey.Delete, CmdSafeDeleteChar),
                new Handler(ConsoleKey.Tab, CmdTabOrComplete),
                new Handler(ConsoleKey.Escape, CmdSkip),

                // Emacs keys
                Handler.Control('A', CmdHome),
                Handler.Control('E', CmdEnd),
                Handler.Control('B', CmdLeft),
                Handler.Control('F', CmdRight),
                Handler.Control('P', CmdHistoryPrev),
                Handler.Control('N', CmdHistoryNext),
                Handler.Control('K', CmdKillToEOF),
                Handler.Control('Y', CmdYank),
                Handler.Control('D', CmdDeleteChar),
                Handler.Control('L', CmdRefresh),
                Handler.Control('R', CmdReverseSearch),
                Handler.Control('G', delegate {}),
                Handler.Alt('B', ConsoleKey.B, CmdBackwardWord),
                Handler.Alt('F', ConsoleKey.F, CmdForwardWord),

                Handler.Alt('D', ConsoleKey.D, CmdDeleteWord),
                Handler.Alt((char)8, ConsoleKey.Backspace, CmdDeleteBackword),

                // DEBUG
                //Handler.Control ('T', CmdDebug),

                // quote
                Handler.Control('Q', delegate { HandleChar(Console.ReadKey(true).KeyChar); })
            };

            rendered_text = new StringBuilder();
            text          = new StringBuilder();

            history      = new History(name, histsize);
            _tabExpander = new TabExpanderUI();

            //if (File.Exists ("log"))File.Delete ("log");
            //log = File.CreateText ("log");
        }
Example #2
0
        public LineEditor(string name, int histsize)
        {
            handlers = new Handler [] {
                new Handler (ConsoleKey.Home,       CmdHome),
                new Handler (ConsoleKey.End,        CmdEnd),
                new Handler (ConsoleKey.LeftArrow,  CmdLeft),
                new Handler (ConsoleKey.RightArrow, CmdRight),
                new Handler (ConsoleKey.UpArrow,    CmdHistoryPrev),
                new Handler (ConsoleKey.DownArrow,  CmdHistoryNext),
                new Handler (ConsoleKey.Enter,      CmdDone),
                new Handler (ConsoleKey.Backspace,  CmdBackspace),
                new Handler (ConsoleKey.Delete,     CmdSafeDeleteChar),
                new Handler (ConsoleKey.Tab,        CmdTabOrComplete),
                new Handler (ConsoleKey.Escape,     CmdSkip),

                // Emacs keys
                Handler.Control ('A', CmdHome),
                Handler.Control ('E', CmdEnd),
                Handler.Control ('B', CmdLeft),
                Handler.Control ('F', CmdRight),
                Handler.Control ('P', CmdHistoryPrev),
                Handler.Control ('N', CmdHistoryNext),
                Handler.Control ('K', CmdKillToEOF),
                Handler.Control ('Y', CmdYank),
                Handler.Control ('D', CmdDeleteChar),
                Handler.Control ('L', CmdRefresh),
                Handler.Control ('R', CmdReverseSearch),
                Handler.Control ('G', delegate {} ),
                Handler.Alt ('B', ConsoleKey.B, CmdBackwardWord),
                Handler.Alt ('F', ConsoleKey.F, CmdForwardWord),

                Handler.Alt ('D', ConsoleKey.D, CmdDeleteWord),
                Handler.Alt ((char) 8, ConsoleKey.Backspace, CmdDeleteBackword),

                // DEBUG
                //Handler.Control ('T', CmdDebug),

                // quote
                Handler.Control ('Q', delegate { HandleChar (Console.ReadKey (true).KeyChar); })
            };

            rendered_text = new StringBuilder();
            text = new StringBuilder();

            history = new History(name, histsize);
            _tabExpander = new TabExpanderUI();

            //if (File.Exists ("log"))File.Delete ("log");
            //log = File.CreateText ("log"); 
        }
Example #3
0
 public void SetUp()
 {
     _tabExpander = new TabExpanderUI();
     _tabExpander.TabExpansionEvent = DummyExpansion;
 }