Example #1
0
        /// <summary>
        /// Repeat the last recorded character search.
        /// </summary>
        public static void RepeatLastCharSearch(ConsoleKeyInfo?key = null, object arg = null)
        {
            if (!ViCharacterSearcher.IsRepeatable)
            {
                Ding();
                return;
            }

            if (ViCharacterSearcher.WasBackward)
            {
                ViCharacterSearcher.SearchBackward(ViCharacterSearcher.SearchChar, null, ViCharacterSearcher.WasBackoff);
            }
            else
            {
                ViCharacterSearcher.Search(ViCharacterSearcher.SearchChar, null, ViCharacterSearcher.WasBackoff);
            }
        }
Example #2
0
        private static void ViReplaceToChar(char keyChar, ConsoleKeyInfo?key = null, object arg = null)
        {
            int initialCurrent = _singleton._current;

            _singleton._groupUndoHelper.StartGroup(ReplaceChar, arg);
            ViCharacterSearcher.Set(keyChar, isBackward: false, isBackoff: false);
            if (ViCharacterSearcher.SearchDelete(keyChar, arg, backoff: false, instigator: (_key, _arg) => ViReplaceToChar(keyChar, _key, _arg)))
            {
                if (_singleton._current < initialCurrent || _singleton._current >= _singleton._buffer.Length)
                {
                    ViInsertWithAppend(key, arg);
                }
                else
                {
                    ViInsertMode(key, arg);
                }
            }
        }
Example #3
0
 private static void ViDeleteToBeforeCharBack(char keyChar, ConsoleKeyInfo?key = null, object arg = null)
 {
     ViCharacterSearcher.Set(keyChar, isBackward: true, isBackoff: true);
     ViCharacterSearcher.SearchBackwardDelete(keyChar, arg, backoff: true, instigator: (_key, _arg) => ViDeleteToBeforeCharBack(keyChar, _key, _arg));
 }
Example #4
0
 /// <summary>
 /// Deletes backwards until given character.
 /// </summary>
 public static void ViDeleteToCharBack(char keyChar, ConsoleKeyInfo?key = null, object arg = null)
 {
     ViCharacterSearcher.SearchBackwardDelete(keyChar, arg, backoff: false, instigator: (_key, _arg) => ViDeleteToCharBack(keyChar, _key, _arg));
 }
Example #5
0
 private static void ViDeleteToChar(char keyChar, ConsoleKeyInfo?key = null, object arg = null)
 {
     ViCharacterSearcher.Set(keyChar, isBackward: false, isBackoff: false);
     ViCharacterSearcher.SearchDelete(keyChar, arg, backoff: false, instigator: (_key, _arg) => ViDeleteToChar(keyChar, _key, _arg));
 }