Example #1
0
        public void PerformCopy(Gtk.Clipboard clipboard)
        {
            if (HasSelection())
            {
                StringBuilder strbld = new StringBuilder();

                TextPosition start = TextPosition.Min(currentPos, selectionStart);
                TextPosition end   = TextPosition.Max(currentPos, selectionStart);
                ForeachLine(start, end, (currentLinePos, strpos, endpos) => {
                    if (endpos - strpos > 0)
                    {
                        strbld.AppendLine(lines[currentLinePos].Substring(strpos, endpos - strpos));
                    }
                    else if (endpos == strpos)
                    {
                        strbld.AppendLine();
                    }
                });
                strbld.Remove(strbld.Length - Environment.NewLine.Length, Environment.NewLine.Length);

                clipboard.Text = strbld.ToString();
            }
            else
            {
                clipboard.Clear();
            }
        }
Example #2
0
 public void PerformCopy(Gtk.Clipboard clipboard)
 {
     if (selectionRelativeIndex > 0)
     {
         clipboard.Text = GetText(linePos, textPos, selectionRelativeIndex);
     }
     else if (selectionRelativeIndex < 0)
     {
         Position p = IndexToPosition(PositionToIndex(new Position(linePos, textPos)) + selectionRelativeIndex);
         clipboard.Text = GetText(p.Line, p.Offset, -selectionRelativeIndex);
     }
     else
     {
         clipboard.Clear();
     }
 }
Example #3
0
 public void Clear()
 {
     clipboard.Clear();
 }
 public override void Clear()
 {
     clipboard.Clear();
 }