# File lib/typing.rb, line 285
                def type_text
                        final = ""
                        @input ||= ""
                        @input = SUBSTITUTIONS.inject(input || "") do |string, (orig, repl)|
                        string.gsub(orig, repl)
                        end

                        # split the input into strings of literal characaters and control characters
                        @input = @input.strip.split(/(\{[A-Za-z0-9]+\})/)
                        @input.each_with_index do |str, i|
                                if (key = find(str)).class == Key #IDIOMATIC?
                                        if key.command_key?
                                                system(gen_exec(final))
                                                # execute the command defined, and type the rest
                                                @input = key.command.call(self) + @input[i+1..-1].join
                                                type_text
                                        else
                                                @seen_cursor = (CURSOR.tokens.include?(str[1...-1])) if !@seen_cursor
                                                final << key.xte_command unless key == CURSOR
                                                self.x_offset += key.x_offset
                                                self.y_offset += key.y_offset
                                        end
                                else
                                        if str.length > 0
                                                self.x_offset += str.length
                                                final << '"str ' + str  + '" '
                                        end
                                end

                                if !@seen_cursor
                                        self.x_offset = 0
                                        self.y_offset = 0
                                end
                        end

                        # Unpress modifier keys at the very end
                        [SHIFT, CONTROL, ALT, META].each do |key|
                                if key.pressed?
                                        final << key.xte_command
                                end
                        end

                        x_offset.times {final += LEFT.xte_command}
                        y_offset.times {final += DOWN.xte_command}

                        if @debug < 1
                                exec(gen_exec(final))
                                exit
                        else
                                final
                        end
                end