state.py 文件源码

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

项目:NeoVintageous 作者: NeoVintageous 项目源码 文件源码
def update_xpos(self, force=False):
        if self.must_update_xpos or force:
            try:
                # TODO: we should check the current mode instead. ============
                sel = self.view.sel()[0]
                pos = sel.b
                if not sel.empty():
                    if sel.a < sel.b:
                        pos -= 1
                # ============================================================
                r = sublime.Region(self.view.line(pos).a, pos)
                counter = Counter(self.view.substr(r))
                tab_size = self.view.settings().get('tab_size')
                xpos = (self.view.rowcol(pos)[1] +
                        ((counter['\t'] * tab_size) - counter['\t']))
            except Exception as e:
                nvim.console_message(e)
                _logger.exception('error setting xpos; default to 0')
                self.xpos = 0
                return
            else:
                self.xpos = xpos
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号