@@ -37,7 +37,7 @@ private readonly IDictionary<TextObjectOperation, IDictionary<TextObjectSpan, Ke
3737 private void ViChordDeleteTextObject ( ConsoleKeyInfo ? key = null , object arg = null )
3838 {
3939 _textObjectOperation = TextObjectOperation . Delete ;
40- ViChordTextObject ( key , arg ) ;
40+ ViChordTextObject ( key , arg ) ;
4141 }
4242
4343 private void ViChordTextObject ( ConsoleKeyInfo ? key = null , object arg = null )
@@ -46,8 +46,8 @@ private void ViChordTextObject(ConsoleKeyInfo? key = null, object arg = null)
4646 {
4747 ResetTextObjectState ( ) ;
4848 throw new ArgumentNullException ( nameof ( key ) ) ;
49- }
50-
49+ }
50+
5151 _textObjectSpan = GetRequestedTextObjectSpan ( key . Value ) ;
5252
5353 // handle text object
@@ -62,25 +62,25 @@ private void ViChordTextObject(ConsoleKeyInfo? key = null, object arg = null)
6262 ResetTextObjectState ( ) ;
6363 Ding ( ) ;
6464 }
65- }
66-
67- private TextObjectSpan GetRequestedTextObjectSpan ( ConsoleKeyInfo key )
68- {
69- if ( key . KeyChar == 'i' )
70- {
71- return TextObjectSpan . Inner ;
65+ }
66+
67+ private TextObjectSpan GetRequestedTextObjectSpan ( ConsoleKeyInfo key )
68+ {
69+ if ( key . KeyChar == 'i' )
70+ {
71+ return TextObjectSpan . Inner ;
7272 }
73- else if ( key . KeyChar == 'a' )
74- {
73+ else if ( key . KeyChar == 'a' )
74+ {
7575 return TextObjectSpan . Around ;
7676 }
77- else
78- {
79- System . Diagnostics . Debug . Assert ( false ) ;
80- throw new NotSupportedException ( ) ;
81- }
82- }
83-
77+ else
78+ {
79+ System . Diagnostics . Debug . Assert ( false ) ;
80+ throw new NotSupportedException ( ) ;
81+ }
82+ }
83+
8484 private static void ViHandleTextObject ( ConsoleKeyInfo ? key = null , object arg = null )
8585 {
8686 if (
@@ -102,63 +102,63 @@ private static void ResetTextObjectState()
102102 _singleton . _textObjectSpan = TextObjectSpan . None ;
103103 }
104104
105- private static void ViDeleteInnerWord ( ConsoleKeyInfo ? key = null , object arg = null )
106- {
105+ private static void ViDeleteInnerWord ( ConsoleKeyInfo ? key = null , object arg = null )
106+ {
107107 var delimiters = _singleton . Options . WordDelimiters ;
108108
109109 if ( ! TryGetArgAsInt ( arg , out var numericArg , 1 ) )
110- return ;
111-
112- if ( _singleton . _buffer . Length == 0 )
113- {
114- if ( numericArg > 1 )
115- {
116- Ding ( ) ;
117- }
118- return ;
119- }
120-
121- // unless at the end of the buffer a single delete word should not delete backwards
122- // so if the cursor is on an empty line, do nothing
123-
124- if (
125- numericArg == 1 &&
126- _singleton . _current < _singleton . _buffer . Length &&
127- _singleton . _buffer . IsLogigalLineEmpty ( _singleton . _current )
128- )
129- {
130- return ;
131- }
132-
133- var start = _singleton . _buffer . ViFindBeginningOfWordObjectBoundary ( _singleton . _current , delimiters ) ;
134- var end = _singleton . _current ;
135-
136- // attempting to find a valid position for multiple words
137- // if no valid position is found, this is a no-op
138-
139- {
140- while ( numericArg -- > 0 && end < _singleton . _buffer . Length )
141- {
142- end = _singleton . _buffer . ViFindBeginningOfNextWordObjectBoundary ( end , delimiters ) ;
143- }
144-
145- // attempting to delete too many words should ding
146-
147- if ( numericArg > 0 )
148- {
149- Ding ( ) ;
150- return ;
151- }
152- }
153-
154- if ( end > 0 && _singleton . _buffer . IsAtEndOfBuffer ( end - 1 ) && _singleton . _buffer . InWord ( end - 1 , delimiters ) )
155- {
156- _singleton . _shouldAppend = true ;
157- }
158-
159- _singleton . RemoveTextToClipboard ( start , end - start ) ;
160- _singleton . AdjustCursorPosition ( start ) ;
161- _singleton . Render ( ) ;
110+ return ;
111+
112+ if ( _singleton . _buffer . Length == 0 )
113+ {
114+ if ( numericArg > 1 )
115+ {
116+ Ding ( ) ;
117+ }
118+ return ;
119+ }
120+
121+ // unless at the end of the buffer a single delete word should not delete backwards
122+ // so if the cursor is on an empty line, do nothing
123+
124+ if (
125+ numericArg == 1 &&
126+ _singleton . _current < _singleton . _buffer . Length &&
127+ _singleton . _buffer . IsLogigalLineEmpty ( _singleton . _current )
128+ )
129+ {
130+ return ;
131+ }
132+
133+ var start = _singleton . _buffer . ViFindBeginningOfWordObjectBoundary ( _singleton . _current , delimiters ) ;
134+ var end = _singleton . _current ;
135+
136+ // attempting to find a valid position for multiple words
137+ // if no valid position is found, this is a no-op
138+
139+ {
140+ while ( numericArg -- > 0 && end < _singleton . _buffer . Length )
141+ {
142+ end = _singleton . _buffer . ViFindBeginningOfNextWordObjectBoundary ( end , delimiters ) ;
143+ }
144+
145+ // attempting to delete too many words should ding
146+
147+ if ( numericArg > 0 )
148+ {
149+ Ding ( ) ;
150+ return ;
151+ }
152+ }
153+
154+ if ( end > 0 && _singleton . _buffer . IsAtEndOfBuffer ( end - 1 ) && _singleton . _buffer . InWord ( end - 1 , delimiters ) )
155+ {
156+ _singleton . _shouldAppend = true ;
157+ }
158+
159+ _singleton . RemoveTextToViRegister ( start , end - start ) ;
160+ _singleton . AdjustCursorPosition ( start ) ;
161+ _singleton . Render ( ) ;
162162 }
163163
164164 /// <summary>
0 commit comments