complete_common_string: Fix common string search

Previously the end of the range() could have been invalid.
complete_common_string: Add note about complete_pos
complete_common_string: consider results together with complete pos

This avoid false matches close to the beginning of the line.