示例#1
0
    def add_placeholders(self, text):
        _ix = [1000]

        def get_ix(m):
            _ix[0] += 1
            return '${%s}' % _ix[0]

        return re.sub(zen.get_caret_placeholder(), get_ix, text)
示例#2
0
    def add_placeholders(self, text, selection=True, explicit_zero=False):
        _ix = [-1 if explicit_zero else 1000]

        def get_ix(m):
            _ix[0] += 1
            return '${%s}' % _ix[0]

        # text = re.sub(r'\$', '\\$', text)
        text = re.sub(utils.get_caret_placeholder(), get_ix, text)

        if selection:
            text = re.sub(r'\$\{(%s)\}' % _ix[0], r'${\1:$SELECTION}', text)

        return text
示例#3
0
    def add_placeholders(self, text, selection=True, explicit_zero=False):
        _ix = [-1 if explicit_zero else 1000]

        def get_ix(m):
            _ix[0] += 1
            return '${%s}' % _ix[0]

        # text = re.sub(r'\$', '\\$', text)
        text = re.sub(utils.get_caret_placeholder(), get_ix, text)

        if selection:
            text = re.sub(r'\$\{(%s)\}' % _ix[0], r'${\1:$SELECTION}', text)

        return text
示例#4
0
文件: editor.py 项目: xexiu/Sublime
    def add_placeholders(self, text, selection=True, explicit_zero=False):
        _ix = [-1 if explicit_zero else 1000]

        def get_ix(m):
            _ix[0] += 1
            return '$%s' % _ix[0]

        # text = re.sub(r'\$', '\\$', text)
        text = re.sub(utils.get_caret_placeholder(), get_ix, text)

        if selection:
            # The last placeholder will contain the selected text, if any
            text = re.sub('\$(%s)' % _ix[0], r'${\1:$SELECTION}', text)

        return text
示例#5
0
    def add_placeholders(self, text, selection=True, explicit_zero=False):
        _ix = [-1 if explicit_zero else 1000]

        def get_ix(m):
            _ix[0] += 1
            return "$%s" % _ix[0]

        # text = re.sub(r'\$', '\\$', text)
        text = re.sub(utils.get_caret_placeholder(), get_ix, text)

        if selection:
            # The last placeholder will contain the selected text, if any
            text = re.sub("\$(%s)" % _ix[0], r"${\1:$SELECTION}", text)

        return text