override public bool Init()
        {
            lines.JoinSelections();
            string text = ClipboardExecutor.GetFromRegister(lines, register);

            if (string.IsNullOrEmpty(text))
            {
                return(false);
            }

            LineSubdivider subdivider = new LineSubdivider(text);

            if (subdivider.GetLinesCount() != selections.Count)
            {
                pasted = new string[selections.Count];
                for (int i = 0; i < pasted.Length; i++)
                {
                    pasted[i] = text;
                }
            }
            else
            {
                pasted = subdivider.GetLines();
                for (int i = 0; i < pasted.Length; i++)
                {
                    pasted[i] = LineSubdivider.GetWithoutEndRN(pasted[i]);
                }
            }
            mementos = GetSelectionMementos();
            return(true);
        }
Beispiel #2
0
 public char GetMapped(char c)
 {
     if (receiver.viMap != null && !ClipboardExecutor.IsEnLayout())
     {
         char result;
         if (receiver.viMap.TryGetValue(c, out result))
         {
             return(result);
         }
     }
     return(c);
 }
        public static string GetFromClipboard()
        {
            if (useFake)
            {
                return(fakeText);
            }
            ClipboardExecutor executer = new ClipboardExecutor();
            Thread            thread   = new Thread(executer.GetFrom);

            thread.SetApartmentState(ApartmentState.STA);
            thread.Start();
            thread.Join();
            return(executer.text);
        }
        public static void PutToClipboard(string text)
        {
            if (useFake)
            {
                fakeText = text;
                return;
            }
            ClipboardExecutor executer = new ClipboardExecutor();

            executer.text = text;
            Thread thread = new Thread(executer.PutTo);

            thread.SetApartmentState(ApartmentState.STA);
            thread.Start();
            thread.Join();
        }
Beispiel #5
0
 public override bool DoFind(Pattern pattern, bool isBackward)
 {
     ClipboardExecutor.PutToSearch(pattern);
     if (ClipboardExecutor.ViRegex != null)
     {
         if (isBackward)
         {
             controller.ViFindBackward(ClipboardExecutor.ViBackwardRegex);
         }
         else
         {
             controller.ViFindForward(ClipboardExecutor.ViRegex);
         }
     }
     return(true);
 }