Module: Tk::Text::IndexModMethods

Included in:
IndexString, TkTextImage, TkTextMark, TkTextTag, TkTextWindow
Defined in:
ext/lib/tk/text.rb

Instance Method Summary collapse

Instance Method Details

#+(mod) ⇒ Object



77
78
79
80
81
82
83
84
85
86
# File 'ext/lib/tk/text.rb', line 77

def +(mod)
  return chars(mod) if mod.kind_of?(Numeric)

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

#-(mod) ⇒ Object



88
89
90
91
92
93
94
95
96
97
98
99
# File 'ext/lib/tk/text.rb', line 88

def -(mod)
  return chars(-mod) if mod.kind_of?(Numeric)

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

#any_chars(mod) ⇒ Object Also known as: any_char



122
123
124
125
126
127
128
129
130
# File 'ext/lib/tk/text.rb', line 122

def any_chars(mod)
  # Tk8.5 feature
  fail ArgumentError, 'expect Integer'  unless mod.kind_of?(Integer)
  if mod < 0
    Tk::Text::IndexString.new(String.new(id) << ' ' << mod.to_s << ' any chars')
  else
    Tk::Text::IndexString.new(String.new(id) << ' + ' << mod.to_s << ' any chars')
  end
end

#any_indices(mod) ⇒ Object



153
154
155
156
157
158
159
160
161
# File 'ext/lib/tk/text.rb', line 153

def any_indices(mod)
  # Tk8.5 feature
  fail ArgumentError, 'expect Integer'  unless mod.kind_of?(Integer)
  if mod < 0
    Tk::Text::IndexString.new(String.new(id) << ' ' << mod.to_s << ' any indices')
  else
    Tk::Text::IndexString.new(String.new(id) << ' + ' << mod.to_s << ' any indices')
  end
end

#any_lines(mod) ⇒ Object Also known as: any_line



184
185
186
187
188
189
190
191
192
# File 'ext/lib/tk/text.rb', line 184

def any_lines(mod)
  # Tk8.5 feature
  fail ArgumentError, 'expect Integer'  unless mod.kind_of?(Integer)
  if mod < 0
    Tk::Text::IndexString.new(String.new(id) << ' ' << mod.to_s << ' any_lines')
  else
    Tk::Text::IndexString.new(String.new(id) << ' + ' << mod.to_s << ' any lines')
  end
end

#chars(mod) ⇒ Object Also known as: char



101
102
103
104
105
106
107
108
# File 'ext/lib/tk/text.rb', line 101

def chars(mod)
  fail ArgumentError, 'expect Integer'  unless mod.kind_of?(Integer)
  if mod < 0
    Tk::Text::IndexString.new(String.new(id) << ' ' << mod.to_s << ' chars')
  else
    Tk::Text::IndexString.new(String.new(id) << ' + ' << mod.to_s << ' chars')
  end
end

#display_chars(mod) ⇒ Object Also known as: display_char



111
112
113
114
115
116
117
118
119
# File 'ext/lib/tk/text.rb', line 111

def display_chars(mod)
  # Tk8.5 feature
  fail ArgumentError, 'expect Integer'  unless mod.kind_of?(Integer)
  if mod < 0
    Tk::Text::IndexString.new(String.new(id) << ' ' << mod.to_s << ' display chars')
  else
    Tk::Text::IndexString.new(String.new(id) << ' + ' << mod.to_s << ' display chars')
  end
end

#display_indices(mod) ⇒ Object



143
144
145
146
147
148
149
150
151
# File 'ext/lib/tk/text.rb', line 143

def display_indices(mod)
  # Tk8.5 feature
  fail ArgumentError, 'expect Integer'  unless mod.kind_of?(Integer)
  if mod < 0
    Tk::Text::IndexString.new(String.new(id) << ' ' << mod.to_s << ' display indices')
  else
    Tk::Text::IndexString.new(String.new(id) << ' + ' << mod.to_s << ' display indices')
  end
end

#display_lineendObject



206
207
208
209
# File 'ext/lib/tk/text.rb', line 206

def display_lineend
  # Tk8.5 feature
  Tk::Text::IndexString.new(String.new(id) << ' display lineend')
end

#display_lines(mod) ⇒ Object Also known as: display_line



173
174
175
176
177
178
179
180
181
# File 'ext/lib/tk/text.rb', line 173

def display_lines(mod)
  # Tk8.5 feature
  fail ArgumentError, 'expect Integer'  unless mod.kind_of?(Integer)
  if mod < 0
    Tk::Text::IndexString.new(String.new(id) << ' ' << mod.to_s << ' display_lines')
  else
    Tk::Text::IndexString.new(String.new(id) << ' + ' << mod.to_s << ' display lines')
  end
end

#display_linestartObject



202
203
204
205
# File 'ext/lib/tk/text.rb', line 202

def display_linestart
  # Tk8.5 feature
  Tk::Text::IndexString.new(String.new(id) << ' display linestart')
end

#display_wordendObject



222
223
224
225
# File 'ext/lib/tk/text.rb', line 222

def display_wordend
  # Tk8.5 feature
  Tk::Text::IndexString.new(String.new(id) << ' display wordend')
end

#display_wordstartObject



218
219
220
221
# File 'ext/lib/tk/text.rb', line 218

def display_wordstart
  # Tk8.5 feature
  Tk::Text::IndexString.new(String.new(id) << ' display wordstart')
end

#indices(mod) ⇒ Object



133
134
135
136
137
138
139
140
141
# File 'ext/lib/tk/text.rb', line 133

def indices(mod)
  # Tk8.5 feature
  fail ArgumentError, 'expect Integer'  unless mod.kind_of?(Integer)
  if mod < 0
    Tk::Text::IndexString.new(String.new(id) << ' ' << mod.to_s << ' indices')
  else
    Tk::Text::IndexString.new(String.new(id) << ' + ' << mod.to_s << ' indices')
  end
end

#lineendObject



198
199
200
# File 'ext/lib/tk/text.rb', line 198

def lineend
  Tk::Text::IndexString.new(String.new(id) << ' lineend')
end

#lines(mod) ⇒ Object Also known as: line



163
164
165
166
167
168
169
170
# File 'ext/lib/tk/text.rb', line 163

def lines(mod)
  fail ArgumentError, 'expect Integer'  unless mod.kind_of?(Integer)
  if mod < 0
    Tk::Text::IndexString.new(String.new(id) << ' ' << mod.to_s << ' lines')
  else
    Tk::Text::IndexString.new(String.new(id) << ' + ' << mod.to_s << ' lines')
  end
end

#linestartObject



195
196
197
# File 'ext/lib/tk/text.rb', line 195

def linestart
  Tk::Text::IndexString.new(String.new(id) << ' linestart')
end

#wordendObject



214
215
216
# File 'ext/lib/tk/text.rb', line 214

def wordend
  Tk::Text::IndexString.new(String.new(id) << ' wordend')
end

#wordstartObject



211
212
213
# File 'ext/lib/tk/text.rb', line 211

def wordstart
  Tk::Text::IndexString.new(String.new(id) << ' wordstart')
end