lib/markdown_exec.rb in markdown_exec-2.2.0 vs lib/markdown_exec.rb in markdown_exec-2.3.0

- old
+ new

@@ -123,11 +123,14 @@ # @param inverse [Boolean] whether the histogram is displayed in inverse order (right to left) def self.display(integer_value, min, max, width, inverse: false) return if max <= min # Ensure the range is valid # Normalize the value within the range 0 to 1 - normalized_value = [0, [(integer_value - min).to_f / (max - min), 1].min].max + normalized_value = [ + 0, + [(integer_value - min).to_f / (max - min), 1].min + ].max # Calculate how many characters should be filled filled_length = (normalized_value * width).round # # Generate the histogram bar using xterm-256 colors (color code 42 is green) @@ -144,15 +147,17 @@ def initialize @chrome_color = :cyan @o_color = :red end - def build_menu(file_names, directory_names, found_in_block_names, files_in_directories, vbn) + def build_menu(file_names, directory_names, found_in_block_names, + files_in_directories, vbn) choices = [] # Adding section title and data for file names - choices << { disabled: '', name: "in #{file_names[:section_title]}".send(@chrome_color) } + choices << { disabled: '', + name: "in #{file_names[:section_title]}".send(@chrome_color) } choices += file_names[:data].map { |str| FileInMenu.for_menu(str) } # Conditionally add directory names if data is present unless directory_names[:data].count.zero? choices << { disabled: '', @@ -462,11 +467,12 @@ @fout.fout 'Searching in: ' \ "#{HashDelegator.new(@options).string_send_color(find_path, :menu_chrome_color)}" searcher = SearchResultsReport.new(value, [find_path]) file_names = searcher.file_names(options, value) - found_in_block_names = searcher.found_in_block_names(options, value, formspec: '%<line>s') + found_in_block_names = searcher.found_in_block_names(options, value, + formspec: '%<line>s') directory_names = searcher.directory_names(options, value) ### search in file contents (block names, chrome, or text) [found_in_block_names, directory_names, @@ -496,12 +502,13 @@ filename, details, = matched_contents nexo = AnsiFormatter.new(@options).format_and_highlight_array( details, highlight: [value] ) - [FileInMenu.for_menu(filename)] + nexo.map do |str| - { disabled: '', name: (' ' * 20) + str } - end + [FileInMenu.for_menu(filename)] + + nexo.map do |str| + { disabled: '', name: (' ' * 20) + str } + end end.flatten choices = MenuBuilder.new.build_menu(file_names, directory_names, found_in_block_names, files_in_directories, vbn)