reline 0.3.4 → 0.3.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3e5c7a3a92a99dc4e59ae8299c90086a1d5508a7aa7f23579ac9e69a516da22a
4
- data.tar.gz: 4779c4eba572d69bda056dafdc974f898678a9a0d40636ffc54836bbcedce2e8
3
+ metadata.gz: 3654e31f9c5d1aa879ae40dfb28b8de68f2e443fac87856f2387a22d61a5b4e7
4
+ data.tar.gz: 0fdccab5b7cfd91274e3e4544dcca69a442176cc85e1eba382da3ffd02f9ac30
5
5
  SHA512:
6
- metadata.gz: ec283bebd9d93cc46c0587da2d051f29a2f119c785eff4a0d554b019a6f4cc2c9503670e0f073c11ce3399b72ecd2b3cdd4d92315251022b4ef54378bb9eea35
7
- data.tar.gz: ffab61dee9ca267ff0015280a0fb0cbd5c76b271867dd86fc1861379af4821929917a467017b1a9b6cd17c92e3bbc74905c7b43865406b5053890bdb42b00007
6
+ metadata.gz: 9277033707e4a1531e8590ae6a76019c21c60da22f69ea333dcc5c3d3610499303ed7892308b6ae3b495237738344baac7a21c547a19ff77f53fecae29be9a14
7
+ data.tar.gz: 5f3f225d7b1ee1f0ab067d8a897366a3d3b922dcedb74ae3ec980e387ad3b520d8ab808f70d89e109d06f7e5017ab6406d30e25ed2b6678b3fc8d6c4d5cf6930
@@ -562,6 +562,16 @@ class Reline::LineEditor
562
562
  @line_editor.instance_variable_get(:@screen_size).last
563
563
  end
564
564
 
565
+ def screen_height
566
+ @line_editor.instance_variable_get(:@screen_size).first
567
+ end
568
+
569
+ def preferred_dialog_height
570
+ rest_height = @line_editor.instance_variable_get(:@rest_height)
571
+ scroll_partial_screen = @line_editor.instance_variable_get(:@scroll_partial_screen) || 0
572
+ [cursor_pos.y - scroll_partial_screen, rest_height, (screen_height + 6) / 5].max
573
+ end
574
+
565
575
  def completion_journey_data
566
576
  @line_editor.instance_variable_get(:@completion_journey_data)
567
577
  end
@@ -714,7 +724,7 @@ class Reline::LineEditor
714
724
  ymax = ymax.clamp(screen_y_range.begin, screen_y_range.end)
715
725
  dialog_y = @first_line_started_from + @started_from
716
726
  cursor_y = dialog_y
717
- if @highest_in_all < ymax
727
+ if @highest_in_all <= ymax
718
728
  scroll_down(ymax - cursor_y)
719
729
  move_cursor_up(ymax - cursor_y)
720
730
  end
@@ -31,21 +31,7 @@ module Reline::Terminfo
31
31
  @curses_dl = false
32
32
  def self.curses_dl
33
33
  return @curses_dl unless @curses_dl == false
34
- if RUBY_VERSION >= '3.0.0'
35
- # Gem module isn't defined in test-all of the Ruby repository, and
36
- # Fiddle in Ruby 3.0.0 or later supports Fiddle::TYPE_VARIADIC.
37
- fiddle_supports_variadic = true
38
- elsif Fiddle.const_defined?(:VERSION,false) and Gem::Version.create(Fiddle::VERSION) >= Gem::Version.create('1.0.1')
39
- # Fiddle::TYPE_VARIADIC is supported from Fiddle 1.0.1.
40
- fiddle_supports_variadic = true
41
- else
42
- fiddle_supports_variadic = false
43
- end
44
- if fiddle_supports_variadic and not Fiddle.const_defined?(:TYPE_VARIADIC)
45
- # If the libffi version is not 3.0.5 or higher, there isn't TYPE_VARIADIC.
46
- fiddle_supports_variadic = false
47
- end
48
- if fiddle_supports_variadic
34
+ if Fiddle.const_defined?(:TYPE_VARIADIC)
49
35
  curses_dl_files.each do |curses_name|
50
36
  result = Fiddle::Handle.new(curses_name)
51
37
  rescue Fiddle::DLError
@@ -1,3 +1,3 @@
1
1
  module Reline
2
- VERSION = '0.3.4'
2
+ VERSION = '0.3.5'
3
3
  end
data/lib/reline.rb CHANGED
@@ -260,7 +260,7 @@ module Reline
260
260
  pos: cursor_pos_to_render,
261
261
  contents: result,
262
262
  scrollbar: true,
263
- height: 15,
263
+ height: [15, preferred_dialog_height].min,
264
264
  bg_color: 46,
265
265
  pointer_bg_color: 45,
266
266
  fg_color: 37,
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.3.4
4
+ version: 0.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - aycabta
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-05-20 00:00:00.000000000 Z
11
+ date: 2023-06-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: io-console