Exemplo n.º 1
0
        void textView_VisualLineConstructionStarting(object sender, VisualLineConstructionStartEventArgs e)
        {
            IHighlighter highlighter = ((TextView)sender).Services.GetService(typeof(IHighlighter)) as IHighlighter;

            if (highlighter != null)
            {
                // Force update of highlighting state up to the position where we start generating visual lines.
                // This is necessary in case the document gets modified above the FirstLineInView so that the highlighting state changes.
                // We need to detect this case and issue a redraw (through TextViewDocumentHighligher.OnHighlightStateChanged)
                // before the visual line construction reuses existing lines that were built using the invalid highlighting state.
                highlighter.GetSpanStack(e.FirstLineInView.LineNumber - 1);
            }
        }
 void textView_VisualLineConstructionStarting(object sender, VisualLineConstructionStartEventArgs e)
 {
     if (highlighter != null)
     {
         // Force update of highlighting state up to the position where we start generating visual lines.
         // This is necessary in case the document gets modified above the FirstLineInView so that the highlighting state changes.
         // We need to detect this case and issue a redraw (through OnHighlightStateChanged)
         // before the visual line construction reuses existing lines that were built using the invalid highlighting state.
         lineNumberBeingColorized = e.FirstLineInView.LineNumber - 1;
         if (!isInHighlightingGroup)
         {
             // avoid opening group twice if there was an exception during the previous visual line construction
             // (not ideal, but better than throwing InvalidOperationException "group already open"
             // without any way of recovering)
             highlighter.BeginHighlighting();
             isInHighlightingGroup = true;
         }
         highlighter.UpdateHighlightingState(lineNumberBeingColorized);
         lineNumberBeingColorized = 0;
     }
 }
Exemplo n.º 3
0
 private void TextView_VisualLineConstructionStarting(object sender, VisualLineConstructionStartEventArgs e)
 {
     // Comments();
 }