Exemplo n.º 1
0
        /// <summary>
        /// Allows the user to surround its selection with custom modification tags
        /// </summary>
        public static void SurroundSelectionWithTag()
        {
            CommonTagAction(fileInfo => {
                var output = new StringBuilder();

                Sci.TargetFromSelection();
                var indent = new String(' ', Sci.GetLine(Sci.LineFromPosition(Sci.TargetStart)).Indentation);

                var opener = ReplaceTokens(fileInfo, Config.Instance.TagModifOpener);
                var eol    = Sci.GetEolString;
                output.Append(opener);
                output.Append(eol);
                output.Append(indent);
                output.Append(Sci.SelectedText);
                output.Append(eol);
                output.Append(indent);
                output.Append(ReplaceTokens(fileInfo, Config.Instance.TagModifCloser));

                Sci.TargetFromSelection();
                Sci.ReplaceTarget(output.ToString());

                Sci.SetSel(Sci.TargetStart + opener.Length + eol.Length);
            });
        }