116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
|
# File 'lib/textbringer/input_methods/t_code_input_method.rb', line 116
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
|