Ejemplo n.º 1
0
    def __evalNormal__(self, char, prevChar):
        """
        Evaluate char (and preceding char) used in normal mode
        Arguments:
            char(string): pressed key
            prevChar(string): previously pressed key
        Returns:
            (cmd): command object. None if no command was found
        """
        lg.debug("eval_vim::__evalNormal__ " +
                 prevChar + char)

        if char is ':':
            self.mode = mode.COMMAND
            val = mapping_normal[":"]
            return cmd(val, "stub")

        val = mapping_normal.get(char, None)
        # Try parsing one letter
        if val is None:
            # Try parsing two letters
            val = mapping_normal.get(prevChar + char)
        return cmd(val)
Ejemplo n.º 2
0
    def __evalCommand__(self, text):
        """
        Evaluate command (string) stated in normal mode
        Arguments:
            text(string): text stated after ":" sign
        Returns:
            (cmd): command object. SWITCH_TO_NORMAL if no command was found
        """
        lg.debug("eval_vim::__evalCommand__ " +
                 text)

        self.mode = mode.NORMAL
        val = mapping_command.get(text, cmd.SWITCH_TO_NORMAL)
        return cmd(val)