Commit Graph

19 Commits

Author SHA1 Message Date
Benjamin Sago
bfa65b3bec Make not showing paths in link targets the default
This commit replaces the “two normal cases” of showing a link’s target or not with “one default and one special case” of preferring to hide them, displaying the link targets by setting a flag instead.

Doing this simplifies the file name constructor, which gets to remove an argument.
2017-07-08 12:24:22 +01:00
Benjamin Sago
0d613652a7 Replace FileName::new with a factory
The new FileStyles value will contain all the fields necessary to “style” a file’s name. Right now this is only the Classify field, but there can be more later. The benefit of this is that when we add more, we won’t need to update all the places where file names are displayed.
2017-07-08 12:11:11 +01:00
Benjamin Sago
31148eda7b Match up fields with parameter names
The arguments passed to File’s constructor were different from the field names used — these might as well both be the same.

Also, move ext and filename to be File methods to save an import, and add tests.

Also also, by passing a PathBuf in to the constructor directly, we can save one (possibly two) instance/s where we pass in a reference to something we were going to lose ownership of anyway, only to have it basically cloned.
2017-06-29 13:07:45 +01:00
Benjamin Sago
2f79b4db03 Start using new shorthand object field syntax 2017-05-18 22:43:32 +01:00
Benjamin Sago
4335f1978c Low-hanging clippy fruit 2017-05-07 17:15:22 +01:00
Benjamin Sago
e916097e0e Similarly, turn Classify into an enum 2017-05-07 15:31:00 +01:00
Benjamin Sago
39381bfb49 Document the recent changes 2017-05-07 15:14:06 +01:00
Benjamin Sago
9f6376a560 Give broken links a different style in grid view
Because the link style and status are now both available to the function that picks the colour style, we can have it highlight broken links differently.

Fixes #131.
2017-05-07 14:45:04 +01:00
Benjamin Sago
ccf8d44058 Replace the links boolean with an enum field 2017-05-07 14:08:36 +01:00
Benjamin Sago
88fecb7b26 Make the link target a field 2017-05-07 10:44:09 +01:00
Benjamin Sago
437ac0ea60 file_name -> FileName#paint 2017-05-02 08:52:24 +01:00
Benjamin Sago
f51f5fe202 Also escape characters in broken symlinks 2017-05-02 08:46:43 +01:00
Benjamin Sago
c81440429f Extract method add_parent_bits 2017-05-01 22:26:16 +01:00
Benjamin Sago
56d4d4c156 Also escape characters in links and headings
Doing this meant that the escaping functionality got used in three places, so it was extracted into a generalised function in its own module.

This is slighly slower for the case where escaped characters are displayed in the same colour as the displayable characters, which happens when listing a directory’s name when recursing. Optimise this, yeah?
2017-05-01 21:54:53 +01:00
Benjamin Sago
2d6d462439 Remember to escape characters in link targets
This was a bug introduced by 28fce347ff — it should have updated both places it does this in the function, rather than just one.
2017-05-01 16:53:51 +01:00
Benjamin Sago
5e0b9e0a10 A file’s colour is actually a style 2017-05-01 15:43:27 +01:00
Benjamin Sago
7531b2617c Split out function for --classify character 2017-05-01 15:41:29 +01:00
Benjamin Sago
05a0a5e199 Structify file_name -> FileName
This turns `file` into `self.file` and `colours` into `self.colours`, but it means we don’t need to pass arguments everywhere, which will be more of a problem the more functions there are.

Most of the code has just been indented.
2017-05-01 15:37:02 +01:00
Benjamin Sago
79feeba67d Move the functions in output to their own module
It didn’t feel quite right to have stand-alone functions in the module root file, which is usually just reserved for modules and exports.
2017-05-01 15:17:07 +01:00