/// <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); } }
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); } } }
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)); }
/// <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)); }
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)); }