@@ -37,7 +37,7 @@ private readonly IDictionary<TextObjectOperation, IDictionary<TextObjectSpan, Ke
37
37
private void ViChordDeleteTextObject ( ConsoleKeyInfo ? key = null , object arg = null )
38
38
{
39
39
_textObjectOperation = TextObjectOperation . Delete ;
40
- ViChordTextObject ( key , arg ) ;
40
+ ViChordTextObject ( key , arg ) ;
41
41
}
42
42
43
43
private void ViChordTextObject ( ConsoleKeyInfo ? key = null , object arg = null )
@@ -46,8 +46,8 @@ private void ViChordTextObject(ConsoleKeyInfo? key = null, object arg = null)
46
46
{
47
47
ResetTextObjectState ( ) ;
48
48
throw new ArgumentNullException ( nameof ( key ) ) ;
49
- }
50
-
49
+ }
50
+
51
51
_textObjectSpan = GetRequestedTextObjectSpan ( key . Value ) ;
52
52
53
53
// handle text object
@@ -62,25 +62,25 @@ private void ViChordTextObject(ConsoleKeyInfo? key = null, object arg = null)
62
62
ResetTextObjectState ( ) ;
63
63
Ding ( ) ;
64
64
}
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 ;
72
72
}
73
- else if ( key . KeyChar == 'a' )
74
- {
73
+ else if ( key . KeyChar == 'a' )
74
+ {
75
75
return TextObjectSpan . Around ;
76
76
}
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
+
84
84
private static void ViHandleTextObject ( ConsoleKeyInfo ? key = null , object arg = null )
85
85
{
86
86
if (
@@ -102,63 +102,63 @@ private static void ResetTextObjectState()
102
102
_singleton . _textObjectSpan = TextObjectSpan . None ;
103
103
}
104
104
105
- private static void ViDeleteInnerWord ( ConsoleKeyInfo ? key = null , object arg = null )
106
- {
105
+ private static void ViDeleteInnerWord ( ConsoleKeyInfo ? key = null , object arg = null )
106
+ {
107
107
var delimiters = _singleton . Options . WordDelimiters ;
108
108
109
109
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 ( ) ;
162
162
}
163
163
164
164
/// <summary>
0 commit comments