@@ -703,17 +703,17 @@ def add_dialog_proc(name, p, context = nil)
703
703
dialog . scroll_top = dialog . pointer
704
704
end
705
705
pointer = dialog . pointer - dialog . scroll_top
706
+ else
707
+ dialog . scroll_top = 0
706
708
end
707
709
dialog . contents = dialog . contents [ dialog . scroll_top , height ]
708
710
end
709
- if dialog . contents and dialog . scroll_top >= dialog . contents . size
710
- dialog . scroll_top = dialog . contents . size - height
711
- end
712
711
if dialog_render_info . scrollbar and dialog_render_info . contents . size > height
713
712
bar_max_height = height * 2
714
713
moving_distance = ( dialog_render_info . contents . size - height ) * 2
715
714
position_ratio = dialog . scroll_top . zero? ? 0.0 : ( ( dialog . scroll_top * 2 ) . to_f / moving_distance )
716
715
bar_height = ( bar_max_height * ( ( dialog . contents . size * 2 ) . to_f / ( dialog_render_info . contents . size * 2 ) ) ) . floor . to_i
716
+ bar_height = 1 if bar_height . zero?
717
717
dialog . scrollbar_pos = ( ( bar_max_height - bar_height ) * position_ratio ) . floor . to_i
718
718
else
719
719
dialog . scrollbar_pos = nil
@@ -755,7 +755,7 @@ def add_dialog_proc(name, p, context = nil)
755
755
str_width = dialog . width - ( dialog . scrollbar_pos . nil? ? 0 : @block_elem_width )
756
756
str = padding_space_with_escape_sequences ( Reline ::Unicode . take_range ( item , 0 , str_width ) , str_width )
757
757
@output . write "\e [#{ bg_color } m\e [#{ fg_color } m#{ str } "
758
- if dialog . scrollbar_pos and ( dialog . scrollbar_pos != old_dialog . scrollbar_pos or dialog . column != old_dialog . column )
758
+ if dialog . scrollbar_pos
759
759
@output . write "\e [37m"
760
760
if dialog . scrollbar_pos <= ( i * 2 ) and ( i * 2 + 1 ) < ( dialog . scrollbar_pos + bar_height )
761
761
@output . write @full_block
0 commit comments