File tree Expand file tree Collapse file tree 2 files changed +17
-18
lines changed
Expand file tree Collapse file tree 2 files changed +17
-18
lines changed Original file line number Diff line number Diff line change @@ -11,28 +11,17 @@ public partial class PSConsoleReadLine
1111 /// <param name="current">The position in the current logical line.</param>
1212 private static int GetBeginningOfLinePos ( int current )
1313 {
14- var newCurrent = current ;
15-
16- if ( _singleton . LineIsMultiLine ( ) )
14+ int i = Math . Max ( 0 , current ) ;
15+ while ( i > 0 )
1716 {
18- int i = Math . Max ( 0 , current ) ;
19- while ( i > 0 )
17+ if ( _singleton . _buffer [ -- i ] == '\n ' )
2018 {
21- if ( _singleton . _buffer [ -- i ] == '\n ' )
22- {
23- i += 1 ;
24- break ;
25- }
19+ i += 1 ;
20+ break ;
2621 }
27-
28- newCurrent = i ;
29- }
30- else
31- {
32- newCurrent = 0 ;
3322 }
3423
35- return newCurrent ;
24+ return i ;
3625 }
3726
3827 /// <summary>
@@ -114,7 +103,7 @@ private static int GetFirstNonBlankOfLogicalLinePos(int current)
114103
115104 var newCurrent = beginningOfLine ;
116105
117- while ( IsVisibleBlank ( newCurrent ) )
106+ while ( newCurrent < _singleton . _buffer . Length && IsVisibleBlank ( newCurrent ) )
118107 {
119108 newCurrent ++ ;
120109 }
Original file line number Diff line number Diff line change @@ -178,6 +178,16 @@ public void ViMoveToFirstNonBlankOfLogicalLine_NoOp_OnEmptyLine()
178178 ) ) ;
179179 }
180180
181+ [ SkippableFact ]
182+ public void ViDefect2050 ( )
183+ {
184+ TestSetup ( KeyMode . Vi ) ;
185+
186+ Test ( "" , Keys (
187+ _ . Escape , _ . Underbar
188+ ) ) ;
189+ }
190+
181191 [ SkippableFact ]
182192 public void ViMoveToEndOfLine_NoOp_OnEmptyLine ( )
183193 {
You can’t perform that action at this time.
0 commit comments