Beispiel #1
0
        public void Paste()
        {
            if (!CanPaste)
            {
                return;
            }

            string content = PlatformExtensions.GetClipboardText();

            // Important: filter valid characters
            if (content != null)
            {
                content = new string (content.Where(IsInputChar).ToArray());
            }

            if (!String.IsNullOrEmpty(content))
            {
                SetUndoInsert(content);
                if (SelLength > 0)
                {
                    DeleteSelection();
                }
                SelLength = 0;
                RowManager.InsertRange(PlatformExtensions.GetClipboardText());
                EnsureCurrentRowVisible();
                ResetSelection();
                Modified = true;
                Invalidate();
            }
        }
Beispiel #2
0
        public void Paste()
        {
            if (!CanPaste)
            {
                return;
            }
            string content = PlatformExtensions.GetClipboardText();

            // Important: filter valid characters
            if (content != null)
            {
                content = new string (content.Where(IsInputChar).ToArray());
            }

            if (!String.IsNullOrEmpty(content))
            {
                SetUndoInsert(content);
                if (SelLength > 0)
                {
                    DeleteSelection();
                }
                SelLength = 0;
                if (Text == null || (CursorPosition >= Text.Length))
                {
                    Text += content;
                }
                else
                {
                    Text = Text.Insert(CursorPosition.Clamp(0, Text.Length - 1), content);
                }

                CursorPosition += content.Length;
                ResetSelection();
                EnsureCursorVisible();
                Modified = true;
                Invalidate();
            }
        }