How to use the regions.NormalizedRegion function in regions

To help you get started, we’ve selected a few regions examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Monnoroch / ColorHighlighter / color_hover_listener.py View on Github external
def _generate_color_regions(self, point):
        self._regions = []
        region = sublime.Region(point, point)
        normalized_region = NormalizedRegion(region)
        for line in self._view.lines(region):
            for (region, color, _) in self._color_searcher.search(self._view, NormalizedRegion(line)):
                if intersects(region, normalized_region):
                    self._regions.append(region)
                    yield (region, color)
github Monnoroch / ColorHighlighter / regions.py View on Github external
def __eq__(self, other):
        """Compare normalized regions for equality."""
        if not isinstance(other, NormalizedRegion):
            return False
        return self.a == other.a and self.b == other.b
github Monnoroch / ColorHighlighter / color_hover_listener.py View on Github external
def on_selection_modified(self):
        """on_selection_modified event."""
        new_selection = [NormalizedRegion(region) for region in self._view.sel()]
        if self._selection != new_selection:
            self._selection = new_selection
            self._on_selection_really_modified()
github Monnoroch / ColorHighlighter / color_selection_listener.py View on Github external
def _generate_lines(view, regions):
    for region in regions:
        for line in view.lines(region):
            yield NormalizedRegion(line)
github Monnoroch / ColorHighlighter / content_listener.py View on Github external
def _generate_lines_for_selection(self):
        for region in self._view.sel():
            for line in self._view.lines(region):
                yield NormalizedRegion(line)
github Monnoroch / ColorHighlighter / color_hover_listener.py View on Github external
def _generate_color_regions(self, point):
        self._regions = []
        region = sublime.Region(point, point)
        normalized_region = NormalizedRegion(region)
        for line in self._view.lines(region):
            for (region, color, _) in self._color_searcher.search(self._view, NormalizedRegion(line)):
                if intersects(region, normalized_region):
                    self._regions.append(region)
                    yield (region, color)
github Monnoroch / ColorHighlighter / color_selection_listener.py View on Github external
def _generate_color_regions(view, color_searcher, regions):
    normalized_regions = [NormalizedRegion(region) for region in regions]
    for line in deduplicate_regions(_generate_lines(view, regions)):
        for color_data in color_searcher.search(view, line):
            if intersects_any(color_data[0], normalized_regions):
                yield color_data
github Monnoroch / ColorHighlighter / content_listener.py View on Github external
def _generate_lines(self):
        for line in self._view.lines(NormalizedRegion(0, self._view.size()).region()):
            yield NormalizedRegion(line)