The line: let start_pos = start_pos - 1 was a bit indecipherable. It changes the startpos to the line above the current line. Instead, now using normal mode `k`. For inner block select: If the cursor is currently on the word 'end', then the current word should be allowed.
Removing the 'c' flag from the searchpair() invokation seems to produce a more predictable result. Previously, the behaviour of 'vie' would be different if your cursor was positioned on the 'd' or the 'o' of 'do'. Now, it is consistent.