Module: TkText::IndexModMethods

Module | TkText::IndexModMethods
In: | tk/lib/tk/text.rb

### Methods

+ - char chars line lineend lines linestart wordend wordstart

### Public Instance methods

+(mod)

[Source]

    # File tk/lib/tk/text.rb, line 72
        def +(mod)
          return chars(mod) if mod.kind_of?(Numeric)

          mod = mod.to_s
          if mod =~ /^\s*[+-]?\d/
            TkText::IndexString.new(String.new(id) << ' + ' << mod)
          else
            TkText::IndexString.new(String.new(id) << ' ' << mod)
          end
        end

-(mod)

[Source]

    # File tk/lib/tk/text.rb, line 83
        def -(mod)
          return chars(-mod) if mod.kind_of?(Numeric)

          mod = mod.to_s
          if mod =~ /^\s*[+-]?\d/
            TkText::IndexString.new(String.new(id) << ' - ' << mod)
          elsif mod =~ /^\s*[-]\s+(\d.*)$/
            TkText::IndexString.new(String.new(id) << ' - -' << $1)
          else
            TkText::IndexString.new(String.new(id) << ' ' << mod)
          end
        end

char(mod)

Alias for chars

chars(mod)

[Source]

    # File tk/lib/tk/text.rb, line 96
        def chars(mod)
          fail ArgumentError, 'expect Integer'  unless mod.kind_of?(Integer)
          if mod < 0
            TkText::IndexString.new(String.new(id) << ' ' << mod.to_s << ' chars')
          else
            TkText::IndexString.new(String.new(id) << ' + ' << mod.to_s << ' chars')
          end
        end

line(mod)

Alias for lines

lineend()

[Source]

    # File tk/lib/tk/text.rb, line 119
        def lineend
          TkText::IndexString.new(String.new(id) << ' lineend')
        end

lines(mod)

[Source]

    # File tk/lib/tk/text.rb, line 106
        def lines(mod)
          fail ArgumentError, 'expect Integer'  unless mod.kind_of?(Integer)
          if mod < 0
            TkText::IndexString.new(String.new(id) << ' ' << mod.to_s << ' lines')
          else
            TkText::IndexString.new(String.new(id) << ' + ' << mod.to_s << ' lines')
          end
        end

linestart()

[Source]

    # File tk/lib/tk/text.rb, line 116
        def linestart
          TkText::IndexString.new(String.new(id) << ' linestart')
        end

wordend()

[Source]

    # File tk/lib/tk/text.rb, line 126
        def wordend
          TkText::IndexString.new(String.new(id) << ' wordend')
        end

wordstart()

[Source]

    # File tk/lib/tk/text.rb, line 123
        def wordstart
          TkText::IndexString.new(String.new(id) << ' wordstart')
        end

[Validate]