Ejemplo n.º 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;
        }
Ejemplo n.º 2
0
        public void SuperSnescriptUndo()
        {
            UndoRedoStruct e = undoRedoList.Undo();

            if (e == default)
            {
                return;
            }
            CanUndoRedo = false;
            if (e.UndoRedoAction == UndoRedoAction.Delete)
            {
                InsertText(e.Position, e.Text);
                CurrentPosition = e.Position + e.Text.Length;
                SelectionStart  = CurrentPosition;
                SelectionEnd    = SelectionStart;
            }
            else if (e.UndoRedoAction == UndoRedoAction.Insert)
            {
                DeleteRange(e.Position, e.Text.Length);
                CurrentPosition = e.Position;
                SelectionStart  = CurrentPosition;
                SelectionEnd    = SelectionStart;
            }
            CanUndoRedo = true;
        }
Ejemplo n.º 3
0
        private void beforeInsert(object sender, BeforeModificationEventArgs e)
        {
            if (CanUndoRedo)
            {
                UndoRedoStruct ne = new UndoRedoStruct(e, UndoRedoAction.Insert);
                undoRedoList.Add(ne);
            }
            int  lineIndex = LineFromPosition(e.Position);
            Line Curl      = Lines[lineIndex];
            int  linePos   = Curl.Position;

            code.ClearFlags();
            code.AddLinesAt(lineIndex, linePos, e.Position, e.Text);
        }