@@ -102,7 +102,7 @@ public static void CancelLine(ConsoleKeyInfo? key = null, object arg = null)
102102 /// </summary>
103103 public static void ForwardDeleteInput ( ConsoleKeyInfo ? key = null , object arg = null )
104104 {
105- ForwardDeleteImpl ( _singleton . _buffer . Length ) ;
105+ ForwardDeleteImpl ( _singleton . _buffer . Length , ForwardDeleteInput ) ;
106106 }
107107
108108 /// <summary>
@@ -111,15 +111,15 @@ public static void ForwardDeleteInput(ConsoleKeyInfo? key = null, object arg = n
111111 /// </summary>
112112 public static void ForwardDeleteLine ( ConsoleKeyInfo ? key = null , object arg = null )
113113 {
114- ForwardDeleteImpl ( GetEndOfLogicalLinePos ( _singleton . _current ) + 1 ) ;
114+ ForwardDeleteImpl ( GetEndOfLogicalLinePos ( _singleton . _current ) + 1 , ForwardDeleteLine ) ;
115115 }
116116
117117 /// <summary>
118118 /// Deletes text from the cursor position to the specified end position
119119 /// but does not put the deleted text in the kill ring.
120120 /// </summary>
121121 /// <param name="endPosition">0-based offset to one character past the end of the text.</param>
122- private static void ForwardDeleteImpl ( int endPosition )
122+ private static void ForwardDeleteImpl ( int endPosition , Action < ConsoleKeyInfo ? , object > instigator )
123123 {
124124 var current = _singleton . _current ;
125125 var buffer = _singleton . _buffer ;
@@ -128,7 +128,15 @@ private static void ForwardDeleteImpl(int endPosition)
128128 {
129129 int length = endPosition - current ;
130130 var str = buffer . ToString ( current , length ) ;
131- _singleton . SaveEditItem ( EditItemDelete . Create ( str , current ) ) ;
131+
132+ _singleton . SaveEditItem (
133+ EditItemDelete . Create (
134+ str ,
135+ current ,
136+ instigator ,
137+ instigatorArg : null ,
138+ ! InViEditMode ( ) ) ) ;
139+
132140 buffer . Remove ( current , length ) ;
133141 _singleton . Render ( ) ;
134142 }
@@ -152,13 +160,13 @@ public static void BackwardDeleteLine(ConsoleKeyInfo? key = null, object arg = n
152160 BackwardDeleteSubstring ( position , BackwardDeleteLine ) ;
153161 }
154162
155- private static void BackwardDeleteSubstring ( int position , Action < ConsoleKeyInfo ? , object > instigator = null )
163+ private static void BackwardDeleteSubstring ( int position , Action < ConsoleKeyInfo ? , object > instigator )
156164 {
157165 if ( _singleton . _current > position )
158166 {
159167 var count = _singleton . _current - position ;
160-
161- _singleton . RemoveTextToViRegister ( position , count , instigator ) ;
168+
169+ _singleton . RemoveTextToViRegister ( position , count , instigator , arg : null , ! InViEditMode ( ) ) ;
162170 _singleton . _current = position ;
163171 _singleton . Render ( ) ;
164172 }
@@ -184,7 +192,7 @@ public static void BackwardDeleteChar(ConsoleKeyInfo? key = null, object arg = n
184192
185193 int startDeleteIndex = _singleton . _current - qty ;
186194
187- _singleton . RemoveTextToViRegister ( startDeleteIndex , qty , BackwardDeleteChar , arg ) ;
195+ _singleton . RemoveTextToViRegister ( startDeleteIndex , qty , BackwardDeleteChar , arg , ! InViEditMode ( ) ) ;
188196 _singleton . _current = startDeleteIndex ;
189197 _singleton . Render ( ) ;
190198 }
@@ -205,7 +213,7 @@ private void DeleteCharImpl(int qty, bool orExit)
205213 {
206214 qty = Math . Min ( qty , _singleton . _buffer . Length - _singleton . _current ) ;
207215
208- RemoveTextToViRegister ( _current , qty , DeleteChar , qty ) ;
216+ RemoveTextToViRegister ( _current , qty , DeleteChar , qty , ! InViEditMode ( ) ) ;
209217 if ( _current >= _buffer . Length )
210218 {
211219 _current = Math . Max ( 0 , _buffer . Length + ViEndOfLineFactor ) ;
0 commit comments