reline 0.1.7 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -0
- data/lib/reline.rb +23 -5
- data/lib/reline/ansi.rb +44 -3
- data/lib/reline/config.rb +9 -7
- data/lib/reline/general_io.rb +15 -1
- data/lib/reline/key_actor/emacs.rb +1 -1
- data/lib/reline/key_actor/vi_command.rb +2 -2
- data/lib/reline/kill_ring.rb +12 -0
- data/lib/reline/line_editor.rb +518 -218
- data/lib/reline/unicode.rb +38 -18
- data/lib/reline/version.rb +1 -1
- data/lib/reline/windows.rb +8 -1
- data/license_of_rb-readline +25 -0
- metadata +4 -5
- data/lib/reline/line_editor.rb.orig +0 -2384
- data/lib/reline/line_editor.rb.rej +0 -81
@@ -1,81 +0,0 @@
|
|
1
|
-
--- lib/reline/line_editor.rb
|
2
|
-
+++ lib/reline/line_editor.rb
|
3
|
-
@@ -1092,60 +1053,38 @@ class Reline::LineEditor
|
4
|
-
|
5
|
-
private def ed_unassigned(key) end # do nothing
|
6
|
-
|
7
|
-
- private def process_insert(force: false)
|
8
|
-
- return if @continuous_insertion_buffer.empty? or (Reline::IOGate.in_pasting? and not force)
|
9
|
-
- #$stderr.puts 'process!!!!!!!'
|
10
|
-
- width = Reline::Unicode.calculate_width(@continuous_insertion_buffer)
|
11
|
-
- bytesize = @continuous_insertion_buffer.bytesize
|
12
|
-
- if @cursor == @cursor_max
|
13
|
-
- @line += @continuous_insertion_buffer
|
14
|
-
- else
|
15
|
-
- @line = byteinsert(@line, @byte_pointer, @continuous_insertion_buffer)
|
16
|
-
- end
|
17
|
-
- #$stderr.puts "#### #{@continuous_insertion_buffer.inspect} => #{@line.inspect}"
|
18
|
-
- #$stderr.puts "width #{width.inspect} bytesize #{bytesize.inspect}"
|
19
|
-
- @byte_pointer += bytesize
|
20
|
-
- @cursor += width
|
21
|
-
- @cursor_max += width
|
22
|
-
- @continuous_insertion_buffer.clear
|
23
|
-
- @rerender_all = true
|
24
|
-
- end
|
25
|
-
-
|
26
|
-
private def ed_insert(key)
|
27
|
-
- str = nil
|
28
|
-
- width = nil
|
29
|
-
- bytesize = nil
|
30
|
-
if key.instance_of?(String)
|
31
|
-
begin
|
32
|
-
key.encode(Encoding::UTF_8)
|
33
|
-
rescue Encoding::UndefinedConversionError
|
34
|
-
return
|
35
|
-
end
|
36
|
-
- str = key
|
37
|
-
- bytesize = key.bytesize
|
38
|
-
+ width = Reline::Unicode.get_mbchar_width(key)
|
39
|
-
+ if @cursor == @cursor_max
|
40
|
-
+ @line += key
|
41
|
-
+ else
|
42
|
-
+ @line = byteinsert(@line, @byte_pointer, key)
|
43
|
-
+ end
|
44
|
-
+ @byte_pointer += key.bytesize
|
45
|
-
+ @cursor += width
|
46
|
-
+ @cursor_max += width
|
47
|
-
else
|
48
|
-
begin
|
49
|
-
key.chr.encode(Encoding::UTF_8)
|
50
|
-
rescue Encoding::UndefinedConversionError
|
51
|
-
return
|
52
|
-
end
|
53
|
-
- str = key.chr
|
54
|
-
- bytesize = 1
|
55
|
-
+ if @cursor == @cursor_max
|
56
|
-
+ @line += key.chr
|
57
|
-
+ else
|
58
|
-
+ @line = byteinsert(@line, @byte_pointer, key.chr)
|
59
|
-
+ end
|
60
|
-
+ width = Reline::Unicode.get_mbchar_width(key.chr)
|
61
|
-
+ @byte_pointer += 1
|
62
|
-
+ @cursor += width
|
63
|
-
+ @cursor_max += width
|
64
|
-
end
|
65
|
-
- if Reline::IOGate.in_pasting?
|
66
|
-
- #$stderr.puts 'pasting!!!!!!'
|
67
|
-
- @continuous_insertion_buffer << str
|
68
|
-
- return
|
69
|
-
- end
|
70
|
-
- width = Reline::Unicode.get_mbchar_width(str)
|
71
|
-
- if @cursor == @cursor_max
|
72
|
-
- @line += str
|
73
|
-
- else
|
74
|
-
- @line = byteinsert(@line, @byte_pointer, str)
|
75
|
-
- end
|
76
|
-
- @byte_pointer += bytesize
|
77
|
-
- @cursor += width
|
78
|
-
- @cursor_max += width
|
79
|
-
end
|
80
|
-
alias_method :ed_digit, :ed_insert
|
81
|
-
alias_method :self_insert, :ed_insert
|