set_next_input: keep only last input when repeatedly called in a single cell

When calling multiple times set_next_input in a single cell execution,
we should only keep the last input.

Closes #1349