25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
# File 'lib/xiki/pause_means_space.rb', line 25
def self.insert_until_pause
c = $el.read_char("insert text (pause means space): ")
return false if c == 13
if c == 127
$el.backward_kill_word 1
return 127
end
inserted = "#{c.chr}"
insert c.chr
o = $el.make_overlay $el.point, $el.point - 1
$el.overlay_put o, :face, :control_lock_found
while(c = read_char("insert text (pause means space): ", nil, 0.24))
$el.delete_overlay o
return false if c == 13
inserted += c.chr
insert c.chr
o = $el.make_overlay $el.point, $el.point - inserted.size
$el.overlay_put o, :face, :control_lock_found
end
$el.delete_overlay o
return inserted
end
|