complete_common_string: Try alternative approach based on candidates

The original approach uses a filetype-specific pattern to match the
common completion.  This fails for filename completion.  Try a different
approach that extracts the common string from all current completion
candidates.  The common string is used to identify the completion
string.