UX recommendation - please see original spec
As commented above:
[Expected results]: A blank area is displayed instead of the "Login Item" of the selected login.
This is expected result based on the user's action: searched for <n>, no matches for <n> found.
In regards to:
The current behaviour has the advantage of not losing the state of what you're doing.
The user has intentionally searched for something - this is exactly what they are doing. Showing mismatched result to a user search is very confusing and unexpected.
Additionally, as noted above, as the search results are filtered in the sidebar, highlight the top match as the user types.
If someone searches for a term that no longer matches the selected login, deselect that login and instead select the top item of the list that matches the search query. This could have the effect of cycling through multiple login detail views in quick succession (as someone is typing) but I think that's ok; we effectively allow someone easy access to the login they need without having to effectively click into a login from the list.