reline 0.5.8 → 0.5.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/reline/config.rb +21 -19
- data/lib/reline/{ansi.rb → io/ansi.rb} +87 -85
- data/lib/reline/io/dumb.rb +106 -0
- data/lib/reline/{windows.rb → io/windows.rb} +102 -102
- data/lib/reline/io.rb +41 -0
- data/lib/reline/key_actor/base.rb +22 -6
- data/lib/reline/key_actor/composite.rb +17 -0
- data/lib/reline/key_actor/emacs.rb +2 -2
- data/lib/reline/key_actor/vi_command.rb +2 -2
- data/lib/reline/key_actor/vi_insert.rb +2 -2
- data/lib/reline/key_actor.rb +1 -0
- data/lib/reline/key_stroke.rb +65 -104
- data/lib/reline/line_editor.rb +31 -28
- data/lib/reline/terminfo.rb +5 -0
- data/lib/reline/version.rb +1 -1
- data/lib/reline.rb +35 -123
- metadata +7 -5
- data/lib/reline/general_io.rb +0 -111
data/lib/reline/general_io.rb
DELETED
@@ -1,111 +0,0 @@
|
|
1
|
-
require 'io/wait'
|
2
|
-
|
3
|
-
class Reline::GeneralIO
|
4
|
-
RESET_COLOR = '' # Do not send color reset sequence
|
5
|
-
|
6
|
-
def self.reset(encoding: nil)
|
7
|
-
@@pasting = false
|
8
|
-
if encoding
|
9
|
-
@@encoding = encoding
|
10
|
-
elsif defined?(@@encoding)
|
11
|
-
remove_class_variable(:@@encoding)
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
def self.encoding
|
16
|
-
if defined?(@@encoding)
|
17
|
-
@@encoding
|
18
|
-
elsif RUBY_PLATFORM =~ /mswin|mingw/
|
19
|
-
Encoding::UTF_8
|
20
|
-
else
|
21
|
-
Encoding::default_external
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
def self.win?
|
26
|
-
false
|
27
|
-
end
|
28
|
-
|
29
|
-
def self.set_default_key_bindings(_)
|
30
|
-
end
|
31
|
-
|
32
|
-
@@buf = []
|
33
|
-
@@input = STDIN
|
34
|
-
|
35
|
-
def self.input=(val)
|
36
|
-
@@input = val
|
37
|
-
end
|
38
|
-
|
39
|
-
def self.with_raw_input
|
40
|
-
yield
|
41
|
-
end
|
42
|
-
|
43
|
-
def self.getc(_timeout_second)
|
44
|
-
unless @@buf.empty?
|
45
|
-
return @@buf.shift
|
46
|
-
end
|
47
|
-
c = nil
|
48
|
-
loop do
|
49
|
-
Reline.core.line_editor.handle_signal
|
50
|
-
result = @@input.wait_readable(0.1)
|
51
|
-
next if result.nil?
|
52
|
-
c = @@input.read(1)
|
53
|
-
break
|
54
|
-
end
|
55
|
-
c&.ord
|
56
|
-
end
|
57
|
-
|
58
|
-
def self.ungetc(c)
|
59
|
-
@@buf.unshift(c)
|
60
|
-
end
|
61
|
-
|
62
|
-
def self.get_screen_size
|
63
|
-
[24, 80]
|
64
|
-
end
|
65
|
-
|
66
|
-
def self.cursor_pos
|
67
|
-
Reline::CursorPos.new(1, 1)
|
68
|
-
end
|
69
|
-
|
70
|
-
def self.hide_cursor
|
71
|
-
end
|
72
|
-
|
73
|
-
def self.show_cursor
|
74
|
-
end
|
75
|
-
|
76
|
-
def self.move_cursor_column(val)
|
77
|
-
end
|
78
|
-
|
79
|
-
def self.move_cursor_up(val)
|
80
|
-
end
|
81
|
-
|
82
|
-
def self.move_cursor_down(val)
|
83
|
-
end
|
84
|
-
|
85
|
-
def self.erase_after_cursor
|
86
|
-
end
|
87
|
-
|
88
|
-
def self.scroll_down(val)
|
89
|
-
end
|
90
|
-
|
91
|
-
def self.clear_screen
|
92
|
-
end
|
93
|
-
|
94
|
-
def self.set_screen_size(rows, columns)
|
95
|
-
end
|
96
|
-
|
97
|
-
def self.set_winch_handler(&handler)
|
98
|
-
end
|
99
|
-
|
100
|
-
@@pasting = false
|
101
|
-
|
102
|
-
def self.in_pasting?
|
103
|
-
@@pasting
|
104
|
-
end
|
105
|
-
|
106
|
-
def self.prep
|
107
|
-
end
|
108
|
-
|
109
|
-
def self.deprep(otio)
|
110
|
-
end
|
111
|
-
end
|