So I'd suggest moving the "last X" update to the actual line selection implementation, i.e. editor_select_lines().
Now by looking at the code (briefly), I'm not even sure if `editor_select_lines()` is the right function - this function is used for various features and possibly not all of them should update "last X" (like e.g. deleting current line).