EndUpdate() public method

public EndUpdate ( ) : void
return void
示例#1
0
        public void SimulateKeyPress(char ch)
        {
            if (Document.ReadOnly)
            {
                return;
            }

            if (TextEditorProperties.UseCustomLine == true)
            {
                if (SelectionManager.HasSomethingSelected)
                {
                    if (Document.CustomLineManager.IsReadOnly(SelectionManager.SelectionCollection[0], false))
                    {
                        return;
                    }
                }
                else if (Document.CustomLineManager.IsReadOnly(Caret.Line, false) == true)
                {
                    return;
                }
            }

            if (ch < ' ')
            {
                return;
            }

            if (!HiddenMouseCursor && TextEditorProperties.HideMouseCursor)
            {
                HiddenMouseCursor = true;
                Cursor.Hide();
            }

            if (!HandleKeyPress(ch))
            {
                motherTextEditorControl.BeginUpdate();
                switch (Caret.CaretMode)
                {
                case CaretMode.InsertMode:
                    InsertChar(ch);
                    break;

                case CaretMode.OverwriteMode:
                    ReplaceChar(ch);
                    break;

                default:
                    Debug.Assert(false, "Unknown caret mode " + Caret.CaretMode);
                    break;
                }
                int currentLineNr = Caret.Line;
                int delta         = Document.FormattingStrategy.FormatLine(this, currentLineNr, Document.PositionToOffset(Caret.Position), ch);

                motherTextEditorControl.EndUpdate();
            }
        }
示例#2
0
        public void SimulateKeyPress(char ch)
        {
            if (Document.ReadOnly)
            {
                return;
            }

            if (ch < ' ')
            {
                return;
            }

            if (!HiddenMouseCursor && TextEditorProperties.HideMouseCursor)
            {
                HiddenMouseCursor = true;
                Cursor.Hide();
            }

            motherTextEditorControl.BeginUpdate();
            switch (ch)
            {
            default:                     // INSERT char
                if (!HandleKeyPress(ch))
                {
                    switch (Caret.CaretMode)
                    {
                    case CaretMode.InsertMode:
                        InsertChar(ch);
                        break;

                    case CaretMode.OverwriteMode:
                        ReplaceChar(ch);
                        break;

                    default:
                        Debug.Assert(false, "Unknown caret mode " + Caret.CaretMode);
                        break;
                    }
                }
                break;
            }

            int currentLineNr = Caret.Line;
            int delta         = Document.FormattingStrategy.FormatLine(this, currentLineNr, Document.PositionToOffset(Caret.Position), ch);

            motherTextEditorControl.EndUpdate();
            if (delta != 0)
            {
//				this.motherTextEditorControl.UpdateLines(currentLineNr, currentLineNr);
            }
        }
示例#3
0
 public void EndUpdate()
 {
     motherTextEditorControl.EndUpdate();
 }
示例#4
0
 /// <summary>Performs an action encapsulated in IEditAction.</summary>
 /// <remarks>
 /// There is an implementation of IEditAction for every action that 
 /// the user can invoke using a shortcut key (arrow keys, Ctrl+X, etc.)
 /// The editor control doesn't provide a public funciton to perform one
 /// of these actions directly, so I wrote DoEditAction() based on the
 /// code in TextArea.ExecuteDialogKey(). You can call ExecuteDialogKey
 /// directly, but it is more fragile because it takes a Keys value (e.g.
 /// Keys.Left) instead of the action to perform.
 /// <para/>
 /// Clipboard commands could also be done by calling methods in
 /// editor.ActiveTextAreaControl.TextArea.ClipboardHandler.
 /// </remarks>
 private void DoEditAction(TextEditorControl editor, ICSharpCode.TextEditor.Actions.IEditAction action)
 {
     if (editor != null && action != null)
     {
         var area = editor.ActiveTextAreaControl.TextArea;
         editor.BeginUpdate();
         try
         {
             lock (editor.Document)
             {
                 action.Execute(area);
                 if (area.SelectionManager.HasSomethingSelected && area.AutoClearSelection /*&& caretchanged*/)
                 {
                     if (area.Document.TextEditorProperties.DocumentSelectionMode == DocumentSelectionMode.Normal)
                     {
                         area.SelectionManager.ClearSelection();
                     }
                 }
             }
         }
         finally
         {
             editor.EndUpdate();
             area.Caret.UpdateCaretPosition();
         }
     }
 }
示例#5
0
        public void SimulateKeyPress(char ch)
        {
            if (Document.ReadOnly)
            {
                return;
            }

            if (TextEditorProperties.UseCustomLine == true)
            {
                if (SelectionManager.HasSomethingSelected)
                {
                    if (SelectionManager.SelectionIsReadonly)
                    {
                        return;
                    }
                }
                else if (Document.CustomLineManager.IsReadOnly(Caret.Line, false) == true)
                {
                    return;
                }
            }

            if (ch < ' ')
            {
                return;
            }

            if (!hiddenMouseCursor && TextEditorProperties.HideMouseCursor)
            {
                if (this.ClientRectangle.Contains(PointToClient(Cursor.Position)))
                {
                    mouseCursorHidePosition = Cursor.Position;
                    hiddenMouseCursor       = true;
                    Cursor.Hide();
                }
            }
            CloseToolTip();

            motherTextEditorControl.BeginUpdate();
            // INSERT char
            if (!HandleKeyPress(ch))
            {
                switch (Caret.CaretMode)
                {
                case CaretMode.InsertMode:
                    InsertChar(ch);
                    break;

                case CaretMode.OverwriteMode:
                    ReplaceChar(ch);
                    break;

                default:
                    Debug.Assert(false, "Unknown caret mode " + Caret.CaretMode);
                    break;
                }
            }

            int currentLineNr = Caret.Line;
            int delta         = Document.FormattingStrategy.FormatLine(this, currentLineNr, Document.PositionToOffset(Caret.Position), ch);

            motherTextEditorControl.EndUpdate();
            if (delta != 0)
            {
//				this.motherTextEditorControl.UpdateLines(currentLineNr, currentLineNr);
            }
        }