Slightly improve on fix for #515: Refactor code and add tests
While I agree with the solution for #515 in commit
17fe790 for now,
other approaches might be interesting in the future, like clearing on
other types of insertion, not just self-insertion.
So add some tests and refactor a new function that could be used for
that purpose later on. For now, change no behaviour.
* yasnippet-tests.el (dont-clear-on-partial-deletion-issue-515,
dont-clear-on-yank-issue-515): New tests. (yas-mock-yank): New
function.
* yasnippet.el (yas--skip-and-clear-field-p): New function.
(yas--on-field-overlay-modification): Use it.