'gets the common prefix (if any) from a list of locations
:param view:
the current view
:param locations:
either a list of points or a list of sublime.Regions'

def get_common_prefix(self, view, locations):

    if ((type(locations[0]) is int) or (type(locations[0]) is long)):
        locations = [getRegion(l, l) for l in locations]
    old_prefix = None
    for location in locations:
        if location.empty():
            word_region = getRegion(self.get_current_word(view, location).begin(), location.b)
            prefix = view.substr(word_region)
        else:
            prefix = view.substr(location)
        if (old_prefix is None):
            old_prefix = prefix
        elif (old_prefix != prefix):
            prefix = ''
            break
    return prefix
