Changeset 8037

Show
Ignore:
Timestamp:
03/17/08 19:24:30 (5 years ago)
Author:
frsyuki
Message:

lang/ruby/vimcolor: Format_ansi#pushを呼ぶ度に@colorsが増殖していたので修正

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lang/ruby/vimcolor/lib/vimcolor.rb

    r8036 r8037  
    1414        def initialize(vim_command = VIM_COMMAND, vim_options = VIM_OPTIONS, vim_preset = VIM_PRESET, vim_postset = VIM_POSTSET) 
    1515                require 'tempfile' 
    16                 @vim_command = vim_command 
    17                 @vim_options = vim_options 
     16                @vim_command = vim_command.dup 
     17                @vim_options = vim_options.dup 
    1818                @vim_preset  = vim_preset.dup 
    1919                @vim_postset = vim_postset.dup 
     
    2626 
    2727                if options.is_a? Hash 
    28                         if options[:filetype] 
     28                        if options.include? :filetype 
    2929                                @vim_postset.push(":set filetype=#{options[:filetype]}") 
    3030                        end 
    31                         if options[:encoding] 
     31                        if options.include? :encoding 
    3232                                @vim_preset.push("+set encoding=#{options[:encoding]}") 
    3333                        end 
     
    7272                formatter = formatter_class.new(*formatter_args) 
    7373                while s.scan_until(/(.*?)>(.*?)>(.*?)<\2</m) 
    74                         formatter.push('', s[1]) 
     74                        formatter.push('', s[1]) unless s[1].empty? 
    7575                        type = s[2] 
    7676                        text = s[3] 
     
    212212                def push(type, text) 
    213213                        seq = '' 
    214                         codes = @colors[type] 
     214                        codes = @colors[type].dup 
    215215                        codes.unshift(:reset) 
    216216                        codes.each {|c|