coderay in Wx::TextCtrl

Ruby code posted by pbr
created at 07 Aug 08:15

Edit | Back
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
    # Puts CodeRay in to a Wx::TextCtrl
    # This colourizes the code
    # k Symbol, t (String|Symbol), ts (text.size|nil)
    def colourize k,t,ts
      if k and t
        c,c1=@ins_pt,ts+@ins_pt unless t.is_a? Symbol
        if t.is_a?(String)
          sty = @styles.get(k)
          set_style(c,c1, sty) unless sty == get_default_style or @styles.style_at(c,c1) == sty
          @styles.set(sty,c,c1)
          @ins_pt=c1
          return
        end 
      end
    end 
490 Bytes in 2 ms with coderay