diff --git a/PSReadLine/BasicEditing.cs b/PSReadLine/BasicEditing.cs index 1a4a5736..814c7bae 100644 --- a/PSReadLine/BasicEditing.cs +++ b/PSReadLine/BasicEditing.cs @@ -465,6 +465,20 @@ public static void AddLine(ConsoleKeyInfo? key = null, object arg = null) /// is on the current line. The cursor moves to the beginning of the new line. /// public static void InsertLineAbove(ConsoleKeyInfo? key = null, object arg = null) + { + // If there are more keys, assume the user pasted with a right click and + // we shouldn't reverse the order of the lines + if (_singleton._queuedKeys.Count > 0) + { + _singleton.AcceptLineImpl(false); + } + else + { + _singleton.InsertLineAboveImpl(); + } + } + + private void InsertLineAboveImpl() { // Move the current position to the beginning of the current line and only the current line. if (_singleton.LineIsMultiLine())