|
@@ -19,6 +19,9 @@ pub struct Options {
|
|
|
/// Whether to prepend icon characters before file names.
|
|
/// Whether to prepend icon characters before file names.
|
|
|
pub show_icons: ShowIcons,
|
|
pub show_icons: ShowIcons,
|
|
|
|
|
|
|
|
|
|
+ /// How to display file names with spaces (with or without quotes).
|
|
|
|
|
+ pub quote_style: QuoteStyle,
|
|
|
|
|
+
|
|
|
/// Whether to make file names hyperlinks.
|
|
/// Whether to make file names hyperlinks.
|
|
|
pub embed_hyperlinks: EmbedHyperlinks,
|
|
pub embed_hyperlinks: EmbedHyperlinks,
|
|
|
}
|
|
}
|
|
@@ -108,6 +111,17 @@ pub enum EmbedHyperlinks {
|
|
|
On,
|
|
On,
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+/// Whether or not to wrap file names with spaces in quotes.
|
|
|
|
|
+#[derive(PartialEq, Debug, Copy, Clone)]
|
|
|
|
|
+pub enum QuoteStyle {
|
|
|
|
|
+ /// Don't ever quote file names.
|
|
|
|
|
+ NoQuotes,
|
|
|
|
|
+
|
|
|
|
|
+ /// Use single quotes for file names that contain spaces and no single quotes
|
|
|
|
|
+ /// Use double quotes for file names that contain single quotes.
|
|
|
|
|
+ QuoteSpaces,
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
/// A **file name** holds all the information necessary to display the name
|
|
/// A **file name** holds all the information necessary to display the name
|
|
|
/// of the given file. This is used in all of the views.
|
|
/// of the given file. This is used in all of the views.
|
|
|
pub struct FileName<'a, 'dir, C> {
|
|
pub struct FileName<'a, 'dir, C> {
|
|
@@ -208,6 +222,9 @@ impl<'a, 'dir, C: Colours> FileName<'a, 'dir, C> {
|
|
|
let target_options = Options {
|
|
let target_options = Options {
|
|
|
classify: Classify::JustFilenames,
|
|
classify: Classify::JustFilenames,
|
|
|
show_icons: ShowIcons::Off,
|
|
show_icons: ShowIcons::Off,
|
|
|
|
|
+
|
|
|
|
|
+ quote_style: QuoteStyle::QuoteSpaces,
|
|
|
|
|
+
|
|
|
embed_hyperlinks: EmbedHyperlinks::Off,
|
|
embed_hyperlinks: EmbedHyperlinks::Off,
|
|
|
};
|
|
};
|
|
|
|
|
|
|
@@ -243,6 +260,7 @@ impl<'a, 'dir, C: Colours> FileName<'a, 'dir, C> {
|
|
|
&mut bits,
|
|
&mut bits,
|
|
|
self.colours.broken_filename(),
|
|
self.colours.broken_filename(),
|
|
|
self.colours.broken_control_char(),
|
|
self.colours.broken_control_char(),
|
|
|
|
|
+ self.options.quote_style,
|
|
|
);
|
|
);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -287,6 +305,7 @@ impl<'a, 'dir, C: Colours> FileName<'a, 'dir, C> {
|
|
|
bits,
|
|
bits,
|
|
|
self.colours.symlink_path(),
|
|
self.colours.symlink_path(),
|
|
|
self.colours.control_char(),
|
|
self.colours.control_char(),
|
|
|
|
|
+ self.options.quote_style,
|
|
|
);
|
|
);
|
|
|
bits.push(
|
|
bits.push(
|
|
|
self.colours
|
|
self.colours
|
|
@@ -373,6 +392,7 @@ impl<'a, 'dir, C: Colours> FileName<'a, 'dir, C> {
|
|
|
&mut bits,
|
|
&mut bits,
|
|
|
file_style,
|
|
file_style,
|
|
|
self.colours.control_char(),
|
|
self.colours.control_char(),
|
|
|
|
|
+ self.options.quote_style,
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
if display_hyperlink {
|
|
if display_hyperlink {
|