/// <summary>
        /// Gets the Pango markup for a given line.
        /// </summary>
        /// <param name="lineIndex">The line index in the buffer or Int32.MaxValue for
        /// the last line.</param>
        /// <param name="lineContexts">The line contexts.</param>
        /// <returns></returns>
        public virtual string GetLineMarkup(
            int lineIndex,
            LineContexts lineContexts)
        {
            string text = GetLineText(lineIndex, LineContexts.None);

            return(PangoUtility.Escape(text));
        }
        public override string GetLineMarkup(
            int lineIndex,
            LineContexts lineContexts)
        {
            // We need to get a read-only lock on the block.
            Block block;

            using (blocks.AcquireBlockLock(RequestLock.Read, lineIndex, out block))
            {
                // Now that we have a block, grab the text and text spans and
                // format them. If we don't have any text spans, we can return
                // a simple formatted string.
                string             text   = block.Text;
                TextSpanCollection spans  = block.TextSpans;
                string             markup = spans.Count == 0
                                        ? PangoUtility.Escape(text)
                                        : FormatText(text, spans);

                // Return the resulting markup.
                return(markup);
            }
        }