reline 0.1.5 → 0.1.10

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.
@@ -1,3 +1,3 @@
1
1
  module Reline
2
- VERSION = '0.1.5'
2
+ VERSION = '0.1.10'
3
3
  end
@@ -199,6 +199,20 @@ class Reline::Windows
199
199
  @@output_buf.unshift(c)
200
200
  end
201
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
+
202
216
  def self.get_screen_size
203
217
  csbi = 0.chr * 22
204
218
  @@GetConsoleScreenBufferInfo.call(@@hConsoleHandle, csbi)
@@ -219,7 +233,9 @@ class Reline::Windows
219
233
 
220
234
  def self.move_cursor_up(val)
221
235
  if val > 0
222
- @@SetConsoleCursorPosition.call(@@hConsoleHandle, (cursor_pos.y - val) * 65536 + cursor_pos.x)
236
+ y = cursor_pos.y - val
237
+ y = 0 if y < 0
238
+ @@SetConsoleCursorPosition.call(@@hConsoleHandle, y * 65536 + cursor_pos.x)
223
239
  elsif val < 0
224
240
  move_cursor_down(-val)
225
241
  end
@@ -227,6 +243,9 @@ class Reline::Windows
227
243
 
228
244
  def self.move_cursor_down(val)
229
245
  if val > 0
246
+ screen_height = get_screen_size.first
247
+ y = cursor_pos.y + val
248
+ y = screen_height - 1 if y > (screen_height - 1)
230
249
  @@SetConsoleCursorPosition.call(@@hConsoleHandle, (cursor_pos.y + val) * 65536 + cursor_pos.x)
231
250
  elsif val < 0
232
251
  move_cursor_up(-val)
@@ -243,6 +262,8 @@ class Reline::Windows
243
262
 
244
263
  def self.scroll_down(val)
245
264
  return if val.zero?
265
+ screen_height = get_screen_size.first
266
+ val = screen_height - 1 if val > (screen_height - 1)
246
267
  scroll_rectangle = [0, val, get_screen_size.last, get_screen_size.first].pack('s4')
247
268
  destination_origin = 0 # y * 65536 + x
248
269
  fill = [' '.ord, 0].pack('SS')
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.5
4
+ version: 0.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - aycabta
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-13 00:00:00.000000000 Z
11
+ date: 2020-12-20 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,6 +103,8 @@ 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/line_editor.rb.orig
107
+ - lib/reline/sibori.rb
92
108
  - lib/reline/unicode.rb
93
109
  - lib/reline/unicode/east_asian_width.rb
94
110
  - lib/reline/version.rb
@@ -112,7 +128,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
112
128
  - !ruby/object:Gem::Version
113
129
  version: '0'
114
130
  requirements: []
115
- rubygems_version: 3.1.2
131
+ rubygems_version: 3.1.4
116
132
  signing_key:
117
133
  specification_version: 4
118
134
  summary: Alternative GNU Readline or Editline implementation by pure Ruby.