359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
|
# File 'lib/textbringer/input_methods/t_code_input_method.rb', line 359
def show_mazegaki_candidates
offset = @mazegaki_candidates_page * mazegaki_limit
candidates = @mazegaki_candidates[offset, mazegaki_limit]
xs = Array.new(40, "-")
candidates.each_with_index do |s, i|
xs[MAZEGAKI_STROKE_PRIORITY_LIST[i]] = s
end
max_width = candidates.map { |s|
Buffer.display_width(s)
}.max
page = @mazegaki_candidates_page + 1
page_count =
(@mazegaki_candidates.size.to_f / mazegaki_limit).ceil
message = xs.map.with_index { |s, i|
space = " " * (max_width - Buffer.display_width(s))
if i % 10 < 5
s + space
else
space + s
end
}.each_slice(10).map.with_index { |ys, i|
if i == 0
" " + ys[0, 4].join(" ") + " " + ys[4, 2].join(" ") + " " +
ys[6, 4].join(" ")
else
"[" + ys[0, 4].join(" ") + "] " + ys[4, 2].join(" ") + " [" +
ys[6, 4].join(" ") + "]"
end
}.join("\n") + " (#{page}/#{page_count})"
show_help(message)
end
|