コード例 #1
0
        private void beforeDelete(object sender, BeforeModificationEventArgs e)
        {
            if (CanUndoRedo)
            {
                UndoRedoStruct ne = new UndoRedoStruct(e, UndoRedoAction.Delete);
                undoRedoList.Add(ne);
            }
            if (adding && e.Text.Length == 1)
            {
                if (sb.Length > 3)
                {
                    sb.Remove(sb.Length - 1, 1);
                    autocom.SearchPattern = sb.ToString();
                    List <AutocompleteItem> items = new List <AutocompleteItem>();

                    List <string> s = code.FilterAutocompleteWords(autocom.SearchPattern);

                    foreach (string def in s)
                    {
                        items.Add(new SnippetAutocompleteItem(def));
                    }
                    curpos = CurrentPosition;
                    autocom.SetAutocompleteItems(items);
                    autocom.CaptureFocus = false;
                    autocom.Show(this, true);
                }
                else
                {
                    autocom.Close();
                }
            }
            curLinesLen = Lines.Count;
        }
コード例 #2
0
 private void codeBox_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyData == (Keys.Space | Keys.Control))
     {
         //forced show (MinFragmentLength will be ignored)
         popupMenu.Show(true);
         e.Handled = true;
     }
     if (e.KeyCode == Keys.Escape)
     {
         popupMenu.Close();
     }
     if (e.KeyData == (Keys.K | Keys.Control))
     {
         codeTextBox.InsertLinePrefix("//");
     }
     if (e.KeyData == (Keys.K | Keys.Control | Keys.Shift))
     {
         codeTextBox.RemoveLinePrefix("//");
     }
     if (e.KeyData == (Keys.Control | Keys.P))
     {
         codeTextBox.CollapseAllFoldingBlocks();
         codeTextBox.ExpandAllFoldingBlocks();
     }
 }
コード例 #3
0
    public void Close(bool done)
    {
        if (!opened)
        {
            return;
        }
        opened = false;

        textBox.AfterKeyPress -= OnKeyPress;
        textBox.FocusedChange -= OnFocusedChange;
        textBox.KeyMap.RemoveBefore(keyMap);
        dropDown.Close();
        if (done)
        {
            if (onDone != null)
            {
                onDone(textBox.Controller, selectedVariant);
            }
        }
    }