コード例 #1
0
        private static void CopySelectionOrLine()
        {
            var scintilla = new ScintillaGateway(PluginBase.GetCurrentScintilla());

            if (scintilla.GetSelectionLength() != 0)
            {
                scintilla.Copy();
            }
            else
            {
                scintilla.CopyAllowLine();
            }
        }
コード例 #2
0
ファイル: Main.cs プロジェクト: genius-by/cobol-insights
        private static void GotoSectionOrPerform()
        {
            if (SNDialogStruct.Form == null)
            {
                SourceNavigationDialog();
            }
            var editor = new ScintillaGateway(PluginBase.GetCurrentScintilla());

            CheckAndSwitchOnCobolWords();
            editor.SetSelection(editor.WordEndPosition(editor.GetCurrentPos(), true), editor.WordStartPosition(editor.GetCurrentPos(), true));

            if (editor.GetSelectionLength() == 0)
            {
                return;
            }
            // If new search
            if (sectionName != editor.GetSelText().ToUpper())
            {
                sectionName = editor.GetSelText().ToUpper();
                int sectionImplementationLine = GetSectionImplementationLine(sectionName);
                if (sectionImplementationLine >= 0)
                {
                    if (editor.GetCurrentLineNumber() == sectionImplementationLine)
                    {
                        if (!SearchNextSectionOrPerform(sectionName, editor.GetCurrentPos().Value))
                        {
                            SearchNextSectionOrPerform(sectionName, 0);
                        }
                    }
                    else
                    {
                        ScrollToLine(sectionImplementationLine);
                        CurrentSearchOffset = sectionImplementationLine;
                    }
                }
                else
                {
                    sectionName = "";
                }
            }
            //If continuing search
            else
            {
                if (!SearchNextSectionOrPerform(sectionName, CurrentSearchOffset))
                {
                    SearchNextSectionOrPerform(sectionName, 0);
                }
            }
        }