| 4752 | } |
| 4753 | |
| 4754 | static size_t |
| 4755 | print_name_with_quoting (const struct fileinfo *f, |
| 4756 | bool symlink_target, |
| 4757 | struct obstack *stack, |
| 4758 | size_t start_col) |
| 4759 | { |
| 4760 | char const *name = symlink_target ? f->linkname : f->name; |
| 4761 | |
| 4762 | const struct bin_str *color |
| 4763 | = print_with_color ? get_color_indicator (f, symlink_target) : NULL; |
| 4764 | |
| 4765 | bool used_color_this_time = (print_with_color |
| 4766 | && (color || is_colored (C_NORM))); |
| 4767 | |
| 4768 | size_t len = quote_name (name, filename_quoting_options, f->quoted, |
| 4769 | color, !symlink_target, stack, f->absolute_name); |
| 4770 | |
| 4771 | process_signals (); |
| 4772 | if (used_color_this_time) |
| 4773 | { |
| 4774 | prep_non_filename_text (); |
| 4775 | |
| 4776 | /* We use the byte length rather than display width here as |
| 4777 | an optimization to avoid accurately calculating the width, |
| 4778 | because we only output the clear to EOL sequence if the name |
| 4779 | _might_ wrap to the next line. This may output a sequence |
| 4780 | unnecessarily in multi-byte locales for example, |
| 4781 | but in that case it's inconsequential to the output. */ |
| 4782 | if (line_length |
| 4783 | && (start_col / line_length != (start_col + len - 1) / line_length)) |
| 4784 | put_indicator (&color_indicator[C_CLR_TO_EOL]); |
| 4785 | } |
| 4786 | |
| 4787 | return len; |
| 4788 | } |
| 4789 | |
| 4790 | static void |
| 4791 | prep_non_filename_text (void) |
no test coverage detected