Пример #1
0
 public void NewLine()
 {
     var startIter = Buffer.GetIterAtMark(promptStart);
     Buffer.InsertWithTagsByName(ref startIter, "\n", "history");
     Buffer.InsertWithTagsByName(ref startIter, "> ", "prompt");
     promptStart = Buffer.CreateMark(null, startIter, true);
     Buffer.PlaceCursor(startIter);
     this.sourceHighlighter = new IncrementalHighlighter(new GtkHighlighter(Buffer));
     column = 0;
 }
Пример #2
0
 static void AssertHighlights(IEnumerable<char> code, IEnumerable<Highlight> highlights)
 {
     using(var testHighlighter = new TestHighlighter(highlights)) {
         var highlighter = new IncrementalHighlighter(testHighlighter);
         var column = 0;
         foreach(var character in code) {
             highlighter.Tokenize(new Character(character, new Location(null, 0, column)));
             column++;
         }
     }
 }
Пример #3
0
        public ReadEvalPrintLoopView(Action<string> evaluator)
            : base(new TextBuffer(new TextTagTable()))
        {
            this.evaluator = evaluator;
            var startIter = Buffer.StartIter;
            promptStart = Buffer.CreateMark(null, startIter, true);
            Buffer.TagTable.Add(new TextTag("prompt") { Editable = false, Weight = Weight.Bold });
            Buffer.TagTable.Add(new TextTag("history") { Editable = false });
            Buffer.TagTable.Add(new TextTag("string") { Foreground ="red" });
            Buffer.TagTable.Add(new TextTag("number") { Foreground ="green" });

            Buffer.InsertWithTagsByName(ref startIter, "> ", "prompt");
            promptStart = Buffer.CreateMark(null, startIter, true);

            this.sourceHighlighter = new IncrementalHighlighter(new GtkHighlighter(Buffer));
        }