walmartlabs/jquery.maskedinput — pull request #2 by akn102 (2014-10-07 18:58:13+00:00)
Title: Bug: Clear buffer when shifting characters to the left

This PR fixes a bug where if you type characters at the end of an input mask and then blur, the typed characters are shifted left to the beginning of the mask but then also duplicated at their original typed position... resulting in some wacky entries like "(44_) ___ - __44". Further focusing / blurring on the input field would repeat this strange duplication + shifting issue.

This fix duplicates the solution found here: https://github.com/digitalBush/jquery.maskedinput/pull/175.

Now, we're clearing the buffer (removing trailing characters) if your cursor position is greater than the length of your input and the characters have been shifted left.

/cc @ryan-roemer @patrickkettner @per-nilsson