Skip to content

Commit

Permalink
Fix - Make sure position is never negative.
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxime Labelle committed Apr 19, 2019
1 parent 04e5335 commit d90202f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion PSReadLine/ViRegister.cs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ public int PasteBefore(StringBuilder buffer, int position)

// we adjust the current position to prevent a crash

position = Math.Min(position, buffer.Length - 1);
position = Math.Max(0, Math.Min(position, buffer.Length - 1));

var text = _text;

Expand Down

0 comments on commit d90202f

Please sign in to comment.