Python sublime 模块,DRAW_NO_OUTLINE 实例源码

我们从Python开源项目中,提取了以下15个代码示例,用于说明如何使用sublime.DRAW_NO_OUTLINE

项目:NeoVintageous    作者:NeoVintageous    | 项目源码 | 文件源码
def on_change(self, s):
        state = self.state
        flags = self.calculate_flags()
        self.view.erase_regions('vi_inc_search')
        next_hit = find_wrapping(self.view,
                                 term=s,
                                 start=self.view.sel()[0].b + 1,
                                 end=self.view.size(),
                                 flags=flags,
                                 times=state.count)
        if next_hit:
            if state.mode == modes.VISUAL:
                next_hit = Region(self.view.sel()[0].a, next_hit.a + 1)

            self.view.add_regions('vi_inc_search', [next_hit], 'string.search', '', DRAW_NO_OUTLINE)

            if not self.view.visible_region().contains(next_hit.b):
                self.view.show(next_hit.b)
项目:NeoVintageous    作者:NeoVintageous    | 项目源码 | 文件源码
def on_change(self, s):
        flags = self.calculate_flags()
        self.view.erase_regions('vi_inc_search')
        state = self.state
        occurrence = reverse_find_wrapping(self.view,
                                           term=s,
                                           start=0,
                                           end=self.view.sel()[0].b,
                                           flags=flags,
                                           times=state.count)
        if occurrence:
            if state.mode == modes.VISUAL:
                occurrence = Region(self.view.sel()[0].a, occurrence.a)

            self.view.add_regions('vi_inc_search', [occurrence], 'string.search', '', DRAW_NO_OUTLINE)

            if not self.view.visible_region().contains(occurrence):
                self.view.show(occurrence)
项目:TerminalView    作者:Wramberg    | 项目源码 | 文件源码
def _update_line_colors(self, line_no, line_color_map):
        # Note this function has been optimized quite a bit. Calls to the ST3
        # API has been left out on purpose as they are slower than the
        # alternative.
        view_region_cache = self._sub_buffer.view_region_cache()
        view_content_cache = self._sub_buffer.view_content_cache()

        for idx, field in line_color_map.items():
            length = field["field_length"]
            color_scope = "terminalview.%s_%s" % (field["color"][0], field["color"][1])

            # Get text point where color should start
            line_start, _ = view_content_cache.get_line_start_and_end_points(line_no)
            color_start = line_start + idx

            # Make region that should be colored
            buffer_region = sublime.Region(color_start, color_start + length)
            region_key = "%i,%s" % (line_no, idx)

            # Add the region
            flags = sublime.DRAW_NO_OUTLINE | sublime.PERSISTENT
            self.view.add_regions(region_key, [buffer_region], color_scope, flags=flags)
            view_region_cache.add(line_no, region_key)
项目:NeoVintageous    作者:NeoVintageous    | 项目源码 | 文件源码
def hilite(self, query):
        regs = self.view.find_all(
            self.build_pattern(query),
            self.calculate_flags()
        )

        if not regs:
            self.view.erase_regions('vi_search')
            return

        # TODO: Re-enable hlsearch toggle setting.
        # if State(self.view).settings.vi['hlsearch'] == False:
        #     return

        self.view.add_regions('vi_search', regs, 'string.search.occurrence', '', sublime.DRAW_NO_OUTLINE)
项目:hyperhelp    作者:OdatNurd    | 项目源码 | 文件源码
def _postprocess_help(view):
    """
    Perform post processing on a loaded help view to do any transformations
    needed on the help content before control is handed back to the user to
    interact with it.
    """
    _postprocess_header(view)

    # Underlink all links.
    # TODO: Populate via a setting only?
    view.add_regions("_hh_link", view.find_by_selector("meta.link"), "storage",
        flags=sublime.DRAW_SOLID_UNDERLINE|sublime.DRAW_NO_FILL|sublime.DRAW_NO_OUTLINE)
项目:SwiftKitten    作者:johncsnyder    | 项目源码 | 文件源码
def on_idle(self, view):
        """
        """
        structure_info = self._get_structure_info(view)
        linting = self.get_settings(view, "linting", True)

        # linting
        if linting and "key.diagnostics" in structure_info:
            diagnostics = structure_info["key.diagnostics"]
            self.errors = {}

            for entry in diagnostics:
                description = entry["key.description"]
                #level = entry['key.severity']
                row, col = entry["key.line"], entry["key.column"]
                pos = view.text_point(row-1,col-1)

                self.errors[pos] = description

            view.add_regions(
                "swiftkitten.diagnostics",
                [Region(pos,pos+1) for pos in self.errors.keys()],
                "constant",
                "",
                sublime.DRAW_STIPPLED_UNDERLINE | sublime.DRAW_NO_OUTLINE | sublime.DRAW_NO_FILL
            )

            self._update_linting_status(view)
项目:SubVale    作者:ValeLint    | 项目源码 | 文件源码
def get_draw_style(self):
        """Get the region styling.
        """
        underlined = sublime.DRAW_NO_FILL | sublime.DRAW_NO_OUTLINE
        style = self.get('vale_alert_style')
        if style == 'solid_underline':
            return sublime.DRAW_SOLID_UNDERLINE | underlined
        elif style == 'stippled_underline':
            return sublime.DRAW_STIPPLED_UNDERLINE | underlined
        elif style == 'squiggly_underline':
            return sublime.DRAW_SQUIGGLY_UNDERLINE | underlined
        return sublime.DRAW_OUTLINED
项目:npm-install    作者:fcannizzaro    | 项目源码 | 文件源码
def update_icons(view):

    file = view.file_name()

    modules = []
    installed = []
    other = []
    result = []

    if file not in data:
        view.run_command('npm_install', {'action': 'initial'})
    else:
        modules = data[file]

    for region in view.find_all(MODULE):
        m = re.search(MODULE, view.substr(region))
        a, b = m.span(1)
        module = m.group(1)
        reg = Region(a + region.begin(), b + region.begin())
        if module in modules or module in CORE:
            installed.append(reg)
        else:
            other.append(reg)
            result.append(module)

    flags = sublime.HIDE_ON_MINIMAP | sublime.DRAW_NO_FILL | sublime.DRAW_NO_OUTLINE | sublime.DRAW_SOLID_UNDERLINE
    view.add_regions('require-on', installed, 'request', ICON % 'on', flags)
    view.add_regions('require-off', other, 'request', ICON % 'off', flags)

    return result
项目:SublimeReddit    作者:deoxxa    | 项目源码 | 文件源码
def draw_t1(self, edit, view, item, indent):
        created = item.get('created_utc', None)
        if created is not None:
            created = datetime.datetime.fromtimestamp(
                created).strftime('%A, %d. %B %Y %I:%M%p')

        title_start = view.size()
        view.insert(edit, view.size(), '%s# [%d] [%s] %s' % (
            indent[2:], item.get('score', 0), item.get('author', ''), created))
        title_end = view.size()
        view.insert(edit, view.size(), '\n\n')
        view.add_regions(
            'thread-%s-title' % (item.get('id', '')),
            [sublime.Region(title_start, title_end)],
            'thread-title',
            'dot',
            flags=sublime.DRAW_NO_FILL | sublime.DRAW_NO_OUTLINE | sublime.DRAW_SOLID_UNDERLINE
        )

        content = wrap(unescape(item.get('body', '')).strip(), indent)

        content_start = view.size()
        view.insert(edit, view.size(), content)
        content_end = view.size() - 1
        view.insert(edit, view.size(), '\n\n')
        view.add_regions(
            'thread-%s-body' % item.get('id', ''),
            [sublime.Region(content_start, content_end)],
            'thread-body',
            flags=sublime.DRAW_NO_FILL | sublime.DRAW_NO_OUTLINE | sublime.HIDE_ON_MINIMAP
        )

        replies = item.get('replies', {})
        if isinstance(replies, dict):
            for child in replies.get('data', {}).get('children', []):
                self.draw_item(edit, view, child, indent + '  ')
项目:SublimeReddit    作者:deoxxa    | 项目源码 | 文件源码
def draw_t3(self, edit, view, item, indent):
        title_start = view.size()
        view.insert(edit, view.size(), '# [%s] [%5d] %s' % (
            item.get('id', ''), item.get('score', 0), item.get('title', '???')))
        title_end = view.size()
        view.insert(edit, view.size(), '\n\n')
        view.add_regions(
            'thread-%s-title' % (item.get('id', '')),
            [sublime.Region(title_start, title_end)],
            'thread-title',
            'bookmark',
            flags=sublime.DRAW_NO_FILL | sublime.DRAW_NO_OUTLINE | sublime.DRAW_SOLID_UNDERLINE
        )

        content = wrap(unescape(item.get('selftext', '')).strip(), indent)

        content_start = view.size()
        view.insert(edit, view.size(), content)
        content_end = view.size() - 1
        view.insert(edit, view.size(), '\n\n')
        view.add_regions(
            'thread-%s-body' % item.get('id', ''),
            [sublime.Region(content_start, content_end)],
            'thread-body',
            flags=sublime.DRAW_NO_FILL | sublime.DRAW_NO_OUTLINE | sublime.HIDE_ON_MINIMAP
        )
项目:Assembly-RGBDS    作者:michalisb    | 项目源码 | 文件源码
def run(self, edit):
        self.view.erase_regions('labels')
        self.view.erase_regions('aliases')
        self.view.erase_regions('macros')
        ctx = ContextManager.instance().getContextFromView(self.view)
        if ctx:
            files = set()
            ctx_sym = ctx.getSymbols(files)
            labels = ContextManager.instance().getExportedLabels() + ctx_sym["labels"]

            scopes = "rgbds.label.local"
            for r in self.view.find_by_selector(scopes):
                local_label = self.view.substr(r)
                if local_label not in labels:
                    labels.append(local_label)      

            label_regions = self.getRegionsFromSymbols(labels)
            aliases_regions = self.getRegionsFromSymbols(ctx_sym["aliases"])
            macros_regions = self.getRegionsFromSymbols(ctx_sym["macros"])


            if len(label_regions):
                self.view.add_regions("labels", label_regions, "rgbdsLabel", '', sublime.DRAW_NO_OUTLINE)
            if len(aliases_regions):
                self.view.add_regions("aliases", aliases_regions, "rgbdsAlias", '', sublime.DRAW_NO_OUTLINE)
            if len(macros_regions):
                self.view.add_regions("macros", macros_regions, "rgbdsMacro", '', sublime.DRAW_NO_OUTLINE)
项目:SublimeDebugger    作者:wvlia5    | 项目源码 | 文件源码
def bp_manager(filename):
    global breakpoints
    V = sublime.active_window().find_open_file(filename)
    if filename not in breakpoints:
        breakpoints.update({filename: {}})
    bps = breakpoints[filename]
    yield bps
    style = "string", "circle", sublime.DRAW_NO_FILL | sublime.DRAW_NO_OUTLINE
    V.add_regions("bp", [get_line(V, l - 1) for l in bps], *style)
    fill_view("Breakpoints", breakpoints_content())
项目:sublime-solium-gutter    作者:sey    | 项目源码 | 文件源码
def add_regions(self, regions):
    package_name = (PLUGIN_FOLDER.split(os.path.sep))[-1]

    if int(sublime.version()) >= 3000:
      icon = "Packages/" + package_name + "/warning.png"
      self.view.add_regions("solium_errors", regions, "keyword", icon,
        sublime.DRAW_EMPTY |
        sublime.DRAW_NO_FILL |
        sublime.DRAW_NO_OUTLINE |
        sublime.DRAW_SQUIGGLY_UNDERLINE)
    else:
      icon = ".." + os.path.sep + package_name + os.path.sep + "warning"
      self.view.add_regions("solium_errors", regions, "keyword", icon,
        sublime.DRAW_EMPTY |
        sublime.DRAW_OUTLINED)
项目:FlowIDE    作者:tptee    | 项目源码 | 文件源码
def run_coverage(self, view):
        settings = find_flow_settings(view.window().project_data())
        if not settings.get('show_coverage'):
            return

        result = None
        try:
            result = CLI(view).coverage()
        except InvalidContext:
            view.erase_regions('flow_error')
            view.erase_regions('flow_uncovered')
        except Exception as e:
            display_unknown_error(self.view, e)

        if not result:
            return

        regions = []

        for line in result['expressions']['uncovered_locs']:
            start = line['start']
            end = line['end']
            row = int(start['line']) - 1
            col = int(start['column']) - 1
            endrow = int(end['line']) - 1
            endcol = int(end['column'])
            regions.append(
                rowcol_to_region(view, row, col, endcol, endrow)
            )

        view.add_regions(
            'flow_uncovered', regions, 'comment', '',
            sublime.DRAW_STIPPLED_UNDERLINE +
            sublime.DRAW_NO_FILL +
            sublime.DRAW_NO_OUTLINE
        )

        uncovered_count = result['expressions']['uncovered_count']
        covered_count_text = 'Flow coverage: {} line{} uncovered'.format(
            uncovered_count, '' if uncovered_count is 1 else 's'
        )
        view.set_status('flow_coverage', covered_count_text)
项目:sublimeTextConfig    作者:luoye-fe    | 项目源码 | 文件源码
def add_lint_marks(view, lines, **errors):
    """Adds lint marks to view on the given lines.
    """

    erase_lint_marks(view)
    types = {
        'warning': errors['warning_underlines'],
        'illegal': errors['error_underlines'],
        'violation': errors['violation_underlines'],
    }
    style = get_settings(view, 'anaconda_linter_mark_style', 'outline')
    show_underlines = get_settings(view, 'anaconda_linter_underlines', True)
    if show_underlines:
        for type_name, underlines in types.items():
            if len(underlines) > 0:
                view.add_regions(
                    'anaconda-lint-underline-{}'.format(type_name), underlines,
                    'anaconda.underline.{}'.format(type_name),
                    flags=sublime.DRAW_EMPTY_AS_OVERWRITE
                )

    if len(lines) > 0:
        outline_style = {
            'solid_underline': sublime.DRAW_NO_FILL | sublime.DRAW_NO_OUTLINE | sublime.DRAW_SOLID_UNDERLINE,
            'stippled_underline': sublime.DRAW_NO_FILL | sublime.DRAW_NO_OUTLINE | sublime.DRAW_STIPPLED_UNDERLINE,
            'squiggly_underline': sublime.DRAW_NO_FILL | sublime.DRAW_NO_OUTLINE | sublime.DRAW_SQUIGGLY_UNDERLINE,
            'outline': sublime.DRAW_OUTLINED,
            'none': sublime.HIDDEN,
            'fill': None
        }
        gutter_theme = get_settings(
            view, 'anaconda_gutter_theme', 'basic').lower()
        package_name = os.path.dirname(__file__).rsplit(os.path.sep, 3)[1]
        ico_path = (
            'Packages/' + package_name + '/anaconda_lib/linting/'
            'gutter_mark_themes/{theme}-{type}.png'
        )

        for lint_type, lints in get_outlines(view).items():
            if len(lints) > 0:
                if get_settings(view, 'anaconda_gutter_marks', False):
                    if gutter_theme == 'basic':
                        gutter_marks = marks[lint_type]
                    else:
                        gutter_marks = ico_path.format(theme=gutter_theme,
                                                       type=lint_type)
                else:
                    gutter_marks = ''

                args = [
                    'anaconda-lint-outlines-{}'.format(lint_type),
                    lints,
                    'anaconda.outline.{}'.format(lint_type),
                    gutter_marks
                ]
                draw_style = outline_style.get(style, sublime.DRAW_OUTLINED)
                if draw_style is not None:
                    args.append(draw_style)

                view.add_regions(*args)