Пример #1
0
    def f(region):
        if not region.a == region.b:
            return region
        point = region.a

        (prev_i, prev_char) = shared.get_previous_character(view, point)
        (next_i, next_char) = shared.get_next_character(view, point)

        if (prev_char == ")" and next_char == "("
                or prev_char == "]" and next_char == "["
                or prev_char == "}" and next_char == "{"):
            return join_sexp(view, edit, prev_i, next_i)
        elif prev_char == "\"" and next_char == "\"":
            return join_sexp(view, edit, prev_i, next_i, False)
        else:
            return shared.remove_spaces(view, edit, point)
Пример #2
0
	def f(region):
		if not region.a == region.b:
			return region
		point = region.a

		(prev_i, prev_char) = shared.get_previous_character(view, point)
		(next_i, next_char) = shared.get_next_character(view, point)

		if (prev_char == ")" and next_char == "(" or
		    prev_char == "]" and next_char == "[" or
		    prev_char == "}" and next_char == "{"):
			return join_sexp(view, edit, prev_i, next_i)
		elif prev_char == "\"" and next_char == "\"":
			return join_sexp(view, edit, prev_i, next_i, False)
		else:
			return shared.remove_spaces(view, edit, point)
Пример #3
0
    def f(region):
        if not region.a == region.b:
            return region
        point = region.a

        (lb, rb) = shared.get_expression(view, point)

        if shared.truthy(lb, rb):
            lc = view.substr(lb)
            rc = view.substr(rb - 1)
            if lc == "\"":
                spaces_start = point
            else:
                spaces_start = shared.remove_spaces(view, edit, point)
            return insert_split_brackets(view, edit, lc, rc, spaces_start)

        return point
Пример #4
0
	def f(region):
		if not region.a == region.b:
			return region
		point = region.a

		(lb, rb) = shared.get_expression(view, point)

		if shared.truthy(lb, rb):
			lc = view.substr(lb)
			rc = view.substr(rb - 1)
			if lc == "\"":
				spaces_start = point
			else:
				spaces_start = shared.remove_spaces(view, edit, point)
			return insert_split_brackets(view, edit, lc, rc, spaces_start)

		return point
Пример #5
0
	def f(region):
		s = region.begin()
		e = region.end()

		if not s == e: view.erase(edit, region)
		return shared.remove_spaces(view, edit, s, False)
Пример #6
0
    def f(region):
        s = region.begin()
        e = region.end()

        if not s == e: view.erase(edit, region)
        return shared.remove_spaces(view, edit, s, False)