Skip to content

Workaround for reversed right click paste #565

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions PSReadLine/BasicEditing.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
/// </summary>
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())
Expand Down