| 5083 | } |
| 5084 | |
| 5085 | static void |
| 5086 | print_many_per_line (void) |
| 5087 | { |
| 5088 | idx_t cols = calculate_columns (true); |
| 5089 | struct column_info const *line_fmt = &column_info[cols - 1]; |
| 5090 | |
| 5091 | /* Calculate the number of rows that will be in each column except possibly |
| 5092 | for a short column on the right. */ |
| 5093 | idx_t rows = cwd_n_used / cols + (cwd_n_used % cols != 0); |
| 5094 | |
| 5095 | for (idx_t row = 0; row < rows; row++) |
| 5096 | { |
| 5097 | size_t col = 0; |
| 5098 | idx_t filesno = row; |
| 5099 | size_t pos = 0; |
| 5100 | |
| 5101 | /* Print the next row. */ |
| 5102 | while (true) |
| 5103 | { |
| 5104 | struct fileinfo const *f = sorted_file[filesno]; |
| 5105 | size_t name_length = length_of_file_name_and_frills (f); |
| 5106 | size_t max_name_length = line_fmt->col_arr[col++]; |
| 5107 | print_file_name_and_frills (f, pos); |
| 5108 | |
| 5109 | if (cwd_n_used - rows <= filesno) |
| 5110 | break; |
| 5111 | filesno += rows; |
| 5112 | |
| 5113 | indent (pos + name_length, pos + max_name_length); |
| 5114 | pos += max_name_length; |
| 5115 | } |
| 5116 | putchar (eolbyte); |
| 5117 | } |
| 5118 | } |
| 5119 | |
| 5120 | static void |
| 5121 | print_horizontal (void) |
no test coverage detected