130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
|
# File 'lib/textbringer/input_methods/t_code_input_method.rb', line 130
def mazegaki_convert(pos, yomi)
with_target_buffer do |buffer|
candidates = mazegaki_lookup_candidates(yomi)
if candidates
@mazegaki_yomi = yomi
@mazegaki_suffix = buffer.substring(pos + yomi.bytesize,
buffer.point)
case candidates.size
when 1
buffer.composite_edit do
buffer.delete_region(pos, buffer.point)
buffer.insert("△" + candidates[0] + @mazegaki_suffix)
end
when 2
buffer.composite_edit do
buffer.delete_region(pos, buffer.point)
buffer.insert("△{" + candidates.join(",") + "}" +
@mazegaki_suffix)
end
else
buffer.save_excursion do
buffer.goto_char(pos)
buffer.insert("△")
end
end
@mazegaki_start_pos = pos
@mazegaki_candidates = candidates
@mazegaki_candidates_page = 0
if candidates.size > 2
show_mazegaki_candidates
end
end
Window.redisplay
nil
end
end
|