Exemplo n.º 1
0
    def process_expansion(self, expansion):
        parts = KEY_SPLIT_RE.split(expansion.string)

        for macro in self.macros:
            macro.process(parts)

        expansion.string = ''.join(parts)
Exemplo n.º 2
0
 def process_expansion(self, expansion):
     parts = KEY_SPLIT_RE.split(expansion.string)
     
     for macro in self.macros:        
         macro.process(parts)
     
     expansion.string = ''.join(parts)
Exemplo n.º 3
0
    def parsePositionTokens(self, expansion):
        # Check the string for cursor positioning token and apply lefts and ups as appropriate
        if CURSOR_POSITION_TOKEN in expansion.string:  # TODO: Undefined local variable?
            firstpart, secondpart = expansion.string.split(CURSOR_POSITION_TOKEN)
            foundNavigationKey = False

            for key in NAVIGATION_KEYS:
                if key in expansion.string:
                    expansion.lefts = 0
                    foundNavigationKey = True
                    break

            if not foundNavigationKey:
                for section in KEY_SPLIT_RE.split(secondpart):
                    if not Key.is_key(section) or section in [' ', '\n']:
                        expansion.lefts += len(section)

            expansion.string = firstpart + secondpart
Exemplo n.º 4
0
    def parsePositionTokens(self, expansion):
        # Check the string for cursor positioning token and apply lefts and ups as appropriate
        if CURSOR_POSITION_TOKEN in expansion.string:  # TODO: Undefined local variable?
            firstpart, secondpart = expansion.string.split(CURSOR_POSITION_TOKEN)
            foundNavigationKey = False

            for key in NAVIGATION_KEYS:
                if key in expansion.string:
                    expansion.lefts = 0
                    foundNavigationKey = True
                    break

            if not foundNavigationKey:
                for section in KEY_SPLIT_RE.split(secondpart):
                    if not Key.is_key(section) or section in [' ', '\n']:
                        expansion.lefts += len(section)

            expansion.string = firstpart + secondpart
Exemplo n.º 5
0
 def _can_process(self, token):
     if KEY_SPLIT_RE.match(token):
         return token[1:-1].split(' ', 1)[0] == self.ID
     else:
         return False
Exemplo n.º 6
0
 def _can_process(self, token):
     if KEY_SPLIT_RE.match(token):
         return token[1:-1].split(' ', 1)[0] == self.ID
     else:
         return False