public void TSF_Link()
 {
     var tsf = new TextSpanFormatter();
     tsf.Write("go to ");
     tsf.WriteHyperlink("Hell", "Aitch-ee-double-hockeysticks");
     Assert.AreEqual("go to _Hell_\r\n", Flatten(tsf));
 }
 private string Flatten(TextSpanFormatter tsf)
 {
     var model = tsf.GetModel();
     var sb= new StringBuilder();
     var lines = model.GetLineSpans(model.LineCount);
     foreach (var line in lines)
     {
         foreach (var span in line)
         {
             EmitSpanWrapper(span, sb);
             sb.Append(span.GetText());
             EmitSpanWrapper(span, sb);
         }
         sb.AppendLine();
     }
     return sb.ToString();
 }
示例#3
0
        public void DisplaySegment(ImageMapSegment segment, Program program)
        {
            try
            {
                if (segmentView == null ||
                    segment == null ||
                    segment.Designer == null)
                    return;
                this.program = program;
                var tsf = new TextSpanFormatter();
                segment.Designer.Render(
                    segment,
                    program,
                    tsf);
                this.segmentView.TextView.Model = tsf.GetModel();
            }
            catch
            {

            }
        }
示例#4
0
        public void DisplayProcedure(Procedure proc)
        {
            if (codeView == null || proc == null)
                return;

            this.proc = proc;
            var tsf = new TextSpanFormatter();
            var fmt = new CodeFormatter(tsf);
            fmt.InnerFormatter.UseTabs = false;
            fmt.Write(proc);
            this.TextView.Model = tsf.GetModel();
        }
 public void TSF_Text()
 {
     var tsf = new TextSpanFormatter();
     tsf.Write("hello");
     Assert.AreEqual("hello\r\n", Flatten(tsf));
 }
 public void TSF_Empty()
 {
     var tsf = new TextSpanFormatter();
     Assert.AreEqual("", Flatten(tsf));
 }