Skip to content
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

Fix - UpHat (^) does not move the cursor while yanking. #1656

Merged
merged 1 commit into from
Jul 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 4 additions & 12 deletions PSReadLine/YankPaste.vi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -265,20 +265,12 @@ public static void ViYankBeginningOfLine(ConsoleKeyInfo? key = null, object arg
/// </summary>
public static void ViYankToFirstChar(ConsoleKeyInfo? key = null, object arg = null)
{
int start = 0;
while (_singleton.IsWhiteSpace(start))
{
start++;
}
if (start == _singleton._current)
{
return;
}

int length = _singleton._current - start;
var start = GetFirstNonBlankOfLogicalLinePos(_singleton._current);
var length = _singleton._current - start;
if (length > 0)
{
_singleton.SaveToClipboard(start, length);
_clipboard.Record(_singleton._buffer, start, length);
_singleton.MoveCursor(start);
}
}

Expand Down
4 changes: 2 additions & 2 deletions test/YankPasteTest.VI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -379,13 +379,13 @@ public void ViPasteAfterYankFirstNoneBlank()

Test("012", Keys(
"012", _.Escape,
"y", _.Uphat, "P", CheckThat(() => AssertLineIs("01012")), CheckThat(() => AssertCursorLeftIs(3)),
"y", _.Uphat, "P", CheckThat(() => AssertLineIs("01012")), CheckThat(() => AssertCursorLeftIs(1)),
"u"
));

Test(" 123 ", Keys(
" 123 ", _.Escape,
"y", _.Uphat, "P", CheckThat(() => AssertLineIs(" 123 123 ")), CheckThat(() => AssertCursorLeftIs(8)),
"y", _.Uphat, "P", CheckThat(() => AssertLineIs(" 123 123 ")), CheckThat(() => AssertCursorLeftIs(4)),
"u"
));
}
Expand Down