xmotions.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:VintageousPlus 作者: trishume 项目源码 文件源码
def run(self, search_string='', mode=None, count=1):
        def f(view, s):
            if mode == modes.VISUAL:
                return sublime.Region(s.a, match.a + 1)

            elif mode == modes.INTERNAL_NORMAL:
                return sublime.Region(s.a, match.a)

            elif mode == modes.NORMAL:
                return sublime.Region(match.a, match.a)

            elif mode == modes.VISUAL_LINE:
                return sublime.Region(s.a, view.full_line(match.b - 1).b)

            return s

        # This happens when we attempt to repeat the search and there's no search term stored yet.
        if not search_string:
            return

        # We want to start searching right after the current selection.
        current_sel = self.view.sel()[0]
        start = current_sel.b if not current_sel.empty() else current_sel.b + 1
        wrapped_end = self.view.size()

        # TODO: What should we do here? Case-sensitive or case-insensitive search? Configurable?
        # Search wrapping around the end of the buffer.
        # flags = sublime.IGNORECASE | sublime.LITERAL
        flags = self.calculate_flags()
        match = find_wrapping(self.view, search_string, start, wrapped_end, flags=flags, times=count)
        if not match:
            return

        regions_transformer(self.view, f)
        self.hilite(search_string)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号