Exemple #1
0
        public void Execute(object arg)
        {
            ViSDGlobalCount.ResetCommand();
            ArgumentMode am = arg as ArgumentMode;

            if (am != null)
            {
                int    line     = am.vh.TextArea.Caret.Line;
                String filename = am.vh.FileName;
                char   bookmark = am.Argument;
                foreach (Bookmarks.ViSDBookmark b in Bookmarks.ViSDGlobalBookmarks.Bookmarks)
                {
                    if (b.Bookmark == bookmark)
                    {
                        if (b.FileName == filename)
                        {
                            if (b.Line <= am.vh.TextArea.Document.Lines.Count)
                            {
                                am.vh.TextArea.Caret.Line = b.Line;
                                am.vh.TextArea.Caret.BringCaretToView();
                            }
                        }
                    }
                }
            }
        }
Exemple #2
0
        public override bool ServeKey(Key k, ModifierKeys mk)
        {
            bool result = base.ServeKey(k, mk);

            ViSDGlobalCount.Process();
            return(result);
        }
Exemple #3
0
        public void Execute(object arg)
        {
            ArgumentMode am = arg as ArgumentMode;

            if (am != null)
            {
                TextArea ta = am.vh.TextArea;
                if (ta != null)
                {
                    ViSDGlobalCount.UpdLastUsed(this, arg);
                    ViSDGlobalCharSearch.LastSeatchedArgument = am;
                    ViSDGlobalCharSearch.LastSearchedMethod   = this;
                    int caret = ta.Caret.Offset;
                    caret++;
                    String key = String.Format("{0}", am.Argument);
                    char   ch  = ta.Document.GetCharAt(caret);
                    while (String.Format("{0}", ch) != key)
                    {
                        caret++;
                        ch = ta.Document.GetCharAt(caret);
                        if ((ch == '\x0d') || (ch == '\x0a'))
                        {
                            return;
                        }
                    }
                    ta.Caret.Offset = caret;
                }
            }
        }
        public void Execute(object arg)
        {
            ViSDGlobalCount.UpdLastUsed(this, arg);

            ta = arg as TextArea;
            if (ta != null)
            {
                word = ViSDGlobalWordSearch.SearchedWord;
                sc   = GetStringComparisonType(word);
                if (word.Length > 0)
                {
                    startoffset = ta.Caret.Offset;
                    int result = GetNext();
                    if (result >= 0)
                    {
                        Message("Found: " + word);
                        ta.Caret.Offset = result;
                        ta.Caret.BringCaretToView();
                    }
                    else
                    {
                        Message("NotFound: " + word);
                    }
                }
            }
        }
Exemple #5
0
        public void Execute(object arg)
        {
            ArgumentMode am;

            if ((am = arg as ArgumentMode) != null)
            {
                TextArea ta;
                if ((ta = am.vh.TextArea) != null)
                {
                    if (lettersToDelete > 0)
                    {
                        if ((ta.Caret.Offset + lettersToDelete) >= ta.Document.TextLength)
                        {
                            lettersToDelete = ta.Document.TextLength - ta.Caret.Offset;
                        }
                        //prepeare string
                        if (ViSDGlobalText.Text.Length > 0)
                        {
                            string s = "";
                            for (int i = 0; i < lettersToDelete; i++)
                            {
                                s += ViSDGlobalText.Text;
                            }
                            ta.Document.Replace(ta.Caret.Offset, lettersToDelete, s);
                            ViSDGlobalCount.UpdLastUsed(this, am);
                        }
                    }
                }
            }
        }
 public void Execute(object arg)
 {
     ta = arg as TextArea;
     if (ta != null)
     {
         ViSDGlobalCount.UpdLastUsed(this, arg);
         int line = ta.Caret.Line;
         int i;
         if (ta.Caret.Line > 1)
         {
             i = ta.Caret.Line - 1;
         }
         else
         {
             i = ta.Document.Lines.Count;
         }
         for ( ; i != ta.Caret.Line; i--)
         {
             if (i == 0)
             {
                 i = ta.Document.Lines.Count;
             }
             if (IsEmpty(ta.Document.Lines[i - 1]))
             {
                 ta.Caret.Line = ta.Document.Lines[i - 1].LineNumber;
                 ta.Caret.BringCaretToView();
                 return;
             }
         }
     }
 }
Exemple #7
0
 public override void Execute(object arg)
 {
     ViSDGlobalCount.ResetCommand();
     ViSDGlobalText.UpdateMove(movecur, arg);
     movecur.Execute(arg);
     ViSDGlobalState.State = State.Insert;
 }
 public void Execute(object arg)
 {
     ViSDGlobalCount.UpdLastUsed(this, arg);
     if (CanExecute())
     {
         ViSDGlobalCharSearch.LastSearchedMethod.Execute(ViSDGlobalCharSearch.LastSeatchedArgument);
     }
 }
Exemple #9
0
 public override void Execute(object arg)
 {
     ViSDGlobalCount.UpdLastUsed(this, arg);
     base.Execute(arg);
     do
     {
         CurLeftWord();
     } while(!IsEmptyBeforeCur());
 }
Exemple #10
0
 void IViCommand.Execute(object arg)
 {
     ViSDGlobalCount.ResetAll();
     if (arg is TextArea)
     {
         (arg as TextArea).Caret.Column = 0;
     }
     System.Windows.Documents.EditingCommands.MoveToLineStart.Execute(null, arg as TextArea);
 }
Exemple #11
0
        void IViCommand.Execute(object arg)
        {
            ViSDGlobalCount.ResetAll();
            TextArea ta = arg as TextArea;

            if (ta != null)
            {
                ta.Caret.Column = 0;
            }
        }
Exemple #12
0
        void IViCommand.Execute(object arg)
        {
            ViSDGlobalCount.UpdLastUsed(this, arg);
            TextArea ta = arg as TextArea;

            if (ta != null)
            {
                System.Windows.Documents.EditingCommands.MoveLeftByCharacter.Execute(null, ta);
            }
        }
Exemple #13
0
        public void Execute(object arg)
        {
            int temp = ViSDGlobalCount.Number;

            Down.Execute(arg);
            BolHard.Execute(arg);
            Bol.Execute(arg);
            ViSDGlobalCount.Number = temp;
            ViSDGlobalCount.UpdLastUsed(this, arg);
        }
Exemple #14
0
        public override bool ServeKey(System.Windows.Input.Key k, System.Windows.Input.ModifierKeys mk)
        {
            bool result = base.ServeKey(k, mk);

            ViSDGlobalCount.Process();
            int CurEndPos = vh.TextArea.Caret.Offset;

            SelectVisual(CurBeginPos, CurEndPos);
            return(result);
        }
Exemple #15
0
 public void Execute(object arg)
 {
     ta = arg as TextArea;
     if (CanExecute())
     {
         ViSDGlobalCount.UpdLastUsed(this, arg);
         System.Windows.Documents.EditingCommands.Backspace.Execute(
             null, ta);
     }
 }
Exemple #16
0
        public void Execute(object arg)
        {
            TextArea ta;

            if ((ta = arg as TextArea) != null)
            {
                ViSDGlobalClipBoard.Paste(ta);
                ViSDGlobalState.State = State.Command;
                ViSDGlobalCount.ResetAll();
            }
        }
Exemple #17
0
 public override bool ServeKey(Key k, ModifierKeys mk)
 {
     if (ViSDGlobalCount.AddNumber(k, mk) == true)
     {
         return(true);
     }
     else
     {
         return(base.ServeKey(k, mk));
     }
 }
Exemple #18
0
        public void Execute(object arg)
        {
            TextArea ta;

            if ((ta = arg as TextArea) != null)
            {
                ViSDGlobalClipBoard.CopySelected(ta);
                ta.Selection.ReplaceSelectionWithText(ta, "");                   //remove selection
                ViSDGlobalState.State = State.Command;
                ViSDGlobalCount.ResetAll();
            }
        }
Exemple #19
0
 public override void Execute(object arg)
 {
     TextArea = arg as TextArea;
     if (TextArea != null)
     {
         base.Execute(TextArea);
         if (CanExecute())
         {
             ViSDGlobalCount.UpdLastUsed(this, arg);
             DelEOL();
         }
     }
 }
        public void Execute(object arg)
        {
            ViSDGlobalCount.ResetCommand();
            ArgumentMode am = arg as ArgumentMode;

            if (am != null)
            {
                int    line     = am.vh.TextArea.Caret.Line;
                String filename = am.vh.FileName;
                char   bookmark = am.Argument;
                Bookmarks.ViSDGlobalBookmarks.Bookmarks.Add(bookmark, filename, line);
            }
        }
Exemple #21
0
        public void Execute(object arg)
        {
            ViSDGlobalCount.ResetAll();
            TextArea ta = arg as TextArea;

            if (ta != null)
            {
                VimHandler vh = ta.ActiveInputHandler as VimHandler;
                if (vh != null)
                {
                    vh.ArgumentMode.ServeArgumentCmd = new CmdToogleBookmark();
                    ViSDGlobalState.State            = State.ArgumentMode;
                }
            }
        }
Exemple #22
0
 public override void Execute(object arg)
 {
     ViSDGlobalCount.UpdLastUsed(this, arg);
     base.Execute(arg);
     while (IsEmptyUnderCur())
     {
         CurRightWord();
     }
     CurRightWord();
     while (IsEmptyBeforeCur())
     {
         CurLeft();
     }
     CurLeft();
 }
        public void Execute(object arg)
        {
            ViSDGlobalCount.ResetCommand();
            TextArea ta = arg as TextArea;

            if (ta != null)
            {
                VimHandler vh = ta.ActiveInputHandler as VimHandler;
                if (vh != null)
                {
                    vh.ArgumentMode.ServeArgumentCmd = new ArgumentCommands.CmdTillChar();
                    ViSDGlobalState.State            = State.ArgumentMode;
                }
            }
        }
Exemple #24
0
 private void DetachingEventHandler(Object sender, EventArgs e)
 {
     if (vh.TextArea.IsFocused)
     {
         LenOnBegin = vh.TextArea.Caret.Offset - CurOnBegin;
         if (LenOnBegin > 0)
         {
             ViSDGlobalText.Text = vh.TextArea.Document.GetText(
                 CurOnBegin, LenOnBegin);
             ViSDGlobalCount.UpdLastUsed(
                 new CmdServeViSDGlobalText(),
                 vh.TextArea);
             ViSDGlobalCount.Process();
         }
     }
 }
Exemple #25
0
 public void Execute(object arg)
 {
     ViSDGlobalCount.ResetAll();
     ta = arg as TextArea;
     if (ta != null)
     {
         double TopLine = ta.TextView.ScrollOffset.Y;
         foreach (VisualLine vl in ta.TextView.VisualLines)
         {
             if (vl.VisualTop >= TopLine)
             {
                 ta.Caret.Line = vl.FirstDocumentLine.LineNumber;
                 return;
             }
         }
     }
 }
Exemple #26
0
        public void Execute(object arg)
        {
            ArgumentMode am = arg as ArgumentMode;

            if (am != null)
            {
                TextArea ta = am.vh.TextArea;
                if (ta != null)
                {
                    ViSDGlobalCount.UpdLastUsed(this, arg);
                    String key = String.Format("{0}", am.Argument);
                    am.vh.TextArea.Document.Replace(am.vh.TextArea.Caret.Offset,
                                                    1,
                                                    key);
                }
            }
        }
Exemple #27
0
 private void TextEnteringEventHandler(Object sender, TextCompositionEventArgs e)
 {
     vh.TextArea.Selection = ICSharpCode.AvalonEdit.Editing.Selection.Empty;
     if (e.Text.Length > 0)
     {
         _argument           = e.Text.ToCharArray()[0];
         ViSDGlobalText.Text = e.Text;
         if (ServeArgumentCmd != null)
         {
             ServeArgumentCmd.Execute(this);
             ServeArgumentCmd = null;
         }
         e.Handled = true;
         ViSDGlobalCount.Process();
         ViSDGlobalState.State = State.Command;
     }
 }
Exemple #28
0
 public void Execute(object arg)
 {
     ViSDGlobalCount.ResetAll();
     ta = arg as TextArea;
     if (ta != null)
     {
         double TopLine = ta.TextView.ScrollOffset.Y;
         foreach (VisualLine vl in ta.TextView.VisualLines)
         {
             if (((vl.VisualTop + 2 * vl.Height) >= (TopLine + ta.TextView.ActualHeight)) ||
                 ((vl.VisualTop + 1 * vl.Height) >= (ta.TextView.DocumentHeight)))
             {
                 ta.Caret.Line = vl.LastDocumentLine.LineNumber;
                 return;
             }
         }
     }
 }
Exemple #29
0
        public void Execute(object arg)
        {
            ta = arg as TextArea;
            int begin, end, caret;

            if (ta != null)
            {
                if (CanExecute())
                {
                    ViSDGlobalCount.UpdLastUsed(cmdf, ta);

                    caret = ta.Caret.Offset;
                    while (IsLetter(caret - 1))
                    {
                        caret--;
                    }
                    begin = caret;
                    while (IsLetter(caret + 1))
                    {
                        caret++;
                    }
                    end = caret;
                    int lenght = end - begin + 1;
                    ViSDGlobalWordSearch.SearchedWord = ta.Document.GetText(begin, lenght);
                    if (begin > 0)
                    {
                        ta.Caret.Offset = begin - 1;
                    }
                    else
                    {
                        ta.Caret.Offset = ta.Document.TextLength - 1;
                    }
                    cmdf.Execute(ta);
                }
                else
                {
                    ViSDGlobalCount.ResetAll();
                }
            }
        }
Exemple #30
0
        public void Execute(object arg)
        {
            TextArea ta = arg as TextArea;

            if (ta != null)
            {
                if (ViSDGlobalCount._number == 0)
                {
                    ta.Caret.Line = ta.Document.Lines.Count;
                    ta.Caret.BringCaretToView();
                }
                else
                {
                    if (ViSDGlobalCount._number <= ta.Document.LineCount)
                    {
                        ta.Caret.Line = ViSDGlobalCount._number;
                        ta.Caret.BringCaretToView();
                    }
                }
                ViSDGlobalCount.ResetAll();
            }
        }