Esempio n. 1
0
        /// <summary>
        /// Возвращает таглайн по форматной строке.
        /// </summary>
        public string GetTagLine([NotNull] string format)
        {
            if (format == null)
            {
                throw new ArgumentNullException("format");
            }

            var res = TextMacrosHelper.ReplaceMacroses(_serviceProvider, format);

            return(res.Length > _maxTagLength
                                ? res.Substring(0, _maxTagLength)
                                : res);
        }
Esempio n. 2
0
        private void FormatEditorStyleNeeded(object sender, StyleNeededEventArgs e)
        {
            var matches = TextMacrosHelper.FindMacroses(_serviceProvider, _formatEditor.Model.Text);

            for (var i = e.StartPosition; i < e.EndPosition; i++)
            {
                _formatEditor.StartStyling(i, 31);

                int length;
                if (matches.TryGetValue(i, out length))
                {
                    _formatEditor.SetStyling(length, _macroStyle);
                    i += length - 1;
                }
                else
                {
                    _formatEditor.SetStyling(1, _defaultStyle);
                }
            }
        }