reline 0.1.9 → 0.1.10

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.9'
2
+ VERSION = '0.1.10'
3
3
  end
@@ -233,7 +233,9 @@ class Reline::Windows
233
233
 
234
234
  def self.move_cursor_up(val)
235
235
  if val > 0
236
- @@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)
237
239
  elsif val < 0
238
240
  move_cursor_down(-val)
239
241
  end
@@ -241,6 +243,9 @@ class Reline::Windows
241
243
 
242
244
  def self.move_cursor_down(val)
243
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)
244
249
  @@SetConsoleCursorPosition.call(@@hConsoleHandle, (cursor_pos.y + val) * 65536 + cursor_pos.x)
245
250
  elsif val < 0
246
251
  move_cursor_up(-val)
@@ -257,6 +262,8 @@ class Reline::Windows
257
262
 
258
263
  def self.scroll_down(val)
259
264
  return if val.zero?
265
+ screen_height = get_screen_size.first
266
+ val = screen_height - 1 if val > (screen_height - 1)
260
267
  scroll_rectangle = [0, val, get_screen_size.last, get_screen_size.first].pack('s4')
261
268
  destination_origin = 0 # y * 65536 + x
262
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.9
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-11-19 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
@@ -103,6 +103,7 @@ files:
103
103
  - lib/reline/key_stroke.rb
104
104
  - lib/reline/kill_ring.rb
105
105
  - lib/reline/line_editor.rb
106
+ - lib/reline/line_editor.rb.orig
106
107
  - lib/reline/sibori.rb
107
108
  - lib/reline/unicode.rb
108
109
  - lib/reline/unicode/east_asian_width.rb
@@ -127,7 +128,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
127
128
  - !ruby/object:Gem::Version
128
129
  version: '0'
129
130
  requirements: []
130
- rubygems_version: 3.1.2
131
+ rubygems_version: 3.1.4
131
132
  signing_key:
132
133
  specification_version: 4
133
134
  summary: Alternative GNU Readline or Editline implementation by pure Ruby.