reline 0.1.4 → 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  module Reline
2
- VERSION = '0.1.4'
2
+ VERSION = '0.1.9'
3
3
  end
@@ -92,6 +92,7 @@ class Reline::Windows
92
92
  @@ReadConsoleInput = Win32API.new('kernel32', 'ReadConsoleInput', ['L', 'P', 'L', 'P'], 'L')
93
93
  @@GetFileType = Win32API.new('kernel32', 'GetFileType', ['L'], 'L')
94
94
  @@GetFileInformationByHandleEx = Win32API.new('kernel32', 'GetFileInformationByHandleEx', ['L', 'I', 'P', 'L'], 'I')
95
+ @@FillConsoleOutputAttribute = Win32API.new('kernel32', 'FillConsoleOutputAttribute', ['L', 'L', 'L', 'L', 'P'], 'L')
95
96
 
96
97
  @@input_buf = []
97
98
  @@output_buf = []
@@ -198,6 +199,20 @@ class Reline::Windows
198
199
  @@output_buf.unshift(c)
199
200
  end
200
201
 
202
+ def self.in_pasting?
203
+ not self.empty_buffer?
204
+ end
205
+
206
+ def self.empty_buffer?
207
+ if not @@input_buf.empty?
208
+ false
209
+ elsif @@kbhit.call == 0
210
+ true
211
+ else
212
+ false
213
+ end
214
+ end
215
+
201
216
  def self.get_screen_size
202
217
  csbi = 0.chr * 22
203
218
  @@GetConsoleScreenBufferInfo.call(@@hConsoleHandle, csbi)
@@ -249,9 +264,17 @@ class Reline::Windows
249
264
  end
250
265
 
251
266
  def self.clear_screen
252
- # TODO: Use FillConsoleOutputCharacter and FillConsoleOutputAttribute
253
- write "\e[2J"
254
- write "\e[1;1H"
267
+ csbi = 0.chr * 22
268
+ return if @@GetConsoleScreenBufferInfo.call(@@hConsoleHandle, csbi) == 0
269
+ buffer_width = csbi[0, 2].unpack('S').first
270
+ attributes = csbi[8, 2].unpack('S').first
271
+ _window_left, window_top, _window_right, window_bottom = *csbi[10,8].unpack('S*')
272
+ fill_length = buffer_width * (window_bottom - window_top + 1)
273
+ screen_topleft = window_top * 65536
274
+ written = 0.chr * 4
275
+ @@FillConsoleOutputCharacter.call(@@hConsoleHandle, 0x20, fill_length, screen_topleft, written)
276
+ @@FillConsoleOutputAttribute.call(@@hConsoleHandle, attributes, fill_length, screen_topleft, written)
277
+ @@SetConsoleCursorPosition.call(@@hConsoleHandle, screen_topleft)
255
278
  end
256
279
 
257
280
  def self.set_screen_size(rows, columns)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reline
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - aycabta
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-25 00:00:00.000000000 Z
11
+ date: 2020-11-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: io-console
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: yamatanooroti
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: 0.0.6
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: 0.0.6
69
83
  description: Alternative GNU Readline or Editline implementation by pure Ruby.
70
84
  email:
71
85
  - aycabta@gmail.com
@@ -89,15 +103,16 @@ files:
89
103
  - lib/reline/key_stroke.rb
90
104
  - lib/reline/kill_ring.rb
91
105
  - lib/reline/line_editor.rb
106
+ - lib/reline/sibori.rb
92
107
  - lib/reline/unicode.rb
93
108
  - lib/reline/unicode/east_asian_width.rb
94
109
  - lib/reline/version.rb
95
110
  - lib/reline/windows.rb
96
111
  homepage: https://github.com/ruby/reline
97
112
  licenses:
98
- - Ruby License
113
+ - Ruby
99
114
  metadata: {}
100
- post_install_message:
115
+ post_install_message:
101
116
  rdoc_options: []
102
117
  require_paths:
103
118
  - lib
@@ -113,7 +128,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
113
128
  version: '0'
114
129
  requirements: []
115
130
  rubygems_version: 3.1.2
116
- signing_key:
131
+ signing_key:
117
132
  specification_version: 4
118
133
  summary: Alternative GNU Readline or Editline implementation by pure Ruby.
119
134
  test_files: []