@@ -722,36 +722,25 @@ public static void DeleteLineToFirstChar(ConsoleKeyInfo? key = null, object arg
722722 /// </summary>
723723 public static void DeleteLine ( ConsoleKeyInfo ? key = null , object arg = null )
724724 {
725- if ( _singleton . LineIsMultiLine ( ) )
726- {
727- var lineCount = _singleton . GetLogicalLineCount ( ) ;
728- var lineIndex = _singleton . GetLogicalLineNumber ( ) - 1 ;
729-
730- TryGetArgAsInt ( arg , out var requestedLineCount , 1 ) ;
725+ var lineCount = _singleton . GetLogicalLineCount ( ) ;
726+ var lineIndex = _singleton . GetLogicalLineNumber ( ) - 1 ;
731727
732- var deletePosition = DeleteLineImpl ( lineIndex , requestedLineCount ) ;
728+ TryGetArgAsInt ( arg , out var requestedLineCount , 1 ) ;
733729
734- // goto the first character of the first remaining logical line
735- var newCurrent = deletePosition + 1 ;
730+ var deletePosition = DeleteLineImpl ( lineIndex , requestedLineCount ) ;
736731
737- if ( lineIndex + requestedLineCount >= lineCount )
738- {
739- // if the delete operation has removed all the remaining lines
740- // goto the first character of the previous logical line
741- newCurrent = GetBeginningOfLinePos ( deletePosition ) ;
742- }
732+ // goto the first character of the first remaining logical line
733+ var newCurrent = deletePosition + 1 ;
743734
744- _singleton . _current = newCurrent ;
745- _singleton . Render ( ) ;
746- }
747- else
735+ if ( lineIndex + requestedLineCount >= lineCount )
748736 {
749- _clipboard . Record ( _singleton . _buffer ) ;
750- _singleton . SaveEditItem ( EditItemDelete . Create ( _clipboard , 0 ) ) ;
751- _singleton . _current = 0 ;
752- _singleton . _buffer . Remove ( 0 , _singleton . _buffer . Length ) ;
753- _singleton . Render ( ) ;
737+ // if the delete operation has removed all the remaining lines
738+ // goto the first character of the previous logical line
739+ newCurrent = GetBeginningOfLinePos ( deletePosition ) ;
754740 }
741+
742+ _singleton . _current = newCurrent ;
743+ _singleton . Render ( ) ;
755744 }
756745
757746 /// <summary>
0 commit comments