about summary refs log tree commit diff stats
Commit message (Collapse)AuthorAgeFilesLines
...
* | Merge branch 'cache-hash'toonn2020-07-081-8/+13
|\ \
| * | Fix check for Nonetoonn2020-07-081-2/+2
| | | | | | | | | | | | | | | `not inode` would fail if the inode happened to be 0. Switched from appending to prepending the inode to avoid appending to long strings.
| * | Add path to cache hashtoonn2020-07-081-11/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Without the `st_dev` the `st_ino` is no longer enough to uniquely identify a file. A disadvantage of including the mtime in the hash is that changed previews don't overwrite the old cache path so the cached grows faster. We use the path to the file to uniquely identify a device. We concatenate it with the `st_ino` which ensures that replacing a file is not enough to cause a collision. This is hashed to create the cache path. Every time we check whether a preview is cached we verify that the file being preview is as old or older than the cached preview. The only differences from the original scheme are the algorithm (SHA-512 now), accepting previews of with the same mtime as the original file and including the inode identifier in the hash.
| * | Drop st_dev from sha512_encodetoonn2020-07-071-2/+1
| | | | | | | | | | | | | | | | | | The device identifier is not necessarily consistent across reboots or system crashes. Since we don't want to regenerate cached previews at every reboot we can't rely on it.
| * | Switch to packing fields for sha512_encodetoonn2020-07-071-5/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The easy solution was to render the `st_dev, st_ino, st_mtime` to a string and encode that before hashing. This solution is more efficient because it packs the numbers as bytes rather than the digits. Technically POSIX.1 does not specify an upper limit on the sizes for these fields. I think it's safe to say none of the major operating systems will use more than 8 bytes/64 bits any time soon.
| * | Fix indendation of sha512_encodetoonn2020-07-071-4/+5
| | |
| * | Hashlib requires objects implementing the buffer APItoonn2020-07-071-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The hashes from python's hashlib only support objects that implement the buffer API. Bytes objects (python 2 string, python 3 string.encode()) are such objects. Passing fields from a stat object to a hash directly caused crashes whenever ranger checked for an image preview. Fixes #2032
* | | Merge pull request #2034 from toonn/py-version-checksWojciech Siewierski2020-07-071-4/+6
|\ \ \ | | | | | | | | Missed a couple py3 version checks
| * | | Refactor _add_character as static methodtoonn2020-07-071-40/+40
| | | |
| * | | Refactor _add_character as functiontoonn2020-07-071-39/+40
| | | | | | | | | | | | | | | | | | | | | | | | The `_add_character` method no longer has any `self` references because of the change in the version check so pylint insists on it being a function instead.
| * | | Missed a couple py3 version checkstoonn2020-07-071-3/+4
|/ / /
* | | Merge branch 'windowserror'toonn2020-07-051-11/+1
|\ \ \
| * | | Remove WindowsErrortoonn2020-07-051-11/+1
|/ / / | | | | | | | | | | | | | | | | | | `WindowsError` has been merged into `OSError` so we can no longer rely on it for disambiguation. This means a previously silent error on Windows regarding the copying of file access times will no longer be silent.
* | | Merge branch 'pylint3k'toonn2020-07-0526-102/+356
|\ \ \
| * | | Apply some PEP8 love to the pylint module and teststoonn2020-07-052-20/+17
| | | |
| * | | Fix two issues caught by pylint3ktoonn2020-07-052-1/+2
| | | | | | | | | | | | | | | | | | | | One lacking `from __future__ import absolute_import` and one implicit-format-spec (a custom check!) : )
| * | | Implement python 2 compatibility checkstoonn2020-07-055-0/+293
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We have been stuck on pylint <2 for a long time now because it dropped some of the python 2 lints we rely on. We maintain compatibility with python 2.6+ and 3.5+ and a lack of lints makes especially the former much harder. Incompatibilities had already snuck in in the form of implicit format specs. By implementing a custom checker we can make sure this doesn't happen again.
| * | | Document expected failure of GH Actiontoonn2020-07-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Github Actions don't support some of our tests, due to `ncurses`. This Action fails intentionally so it might get fixed once we figure it out. If we invert the failure condition to "make CI green" we might forget about it.
| * | | Clarify excluded tests for github workflowtoonn2020-07-052-3/+3
| | | | | | | | | | | | | | | | | | | | Add pytest to the failing workflow because otherwise it's not run with python 2.7.
| * | | Possible bug caught in reviewtoonn2020-07-053-5/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Forgot to cast the `programs` generator to a list when dropping the unnecessary continuation. Miscellaneous alignment fixes.
| * | | Drop explicit return Nonetoonn2020-07-051-1/+0
| | | |
| * | | Use chained comparison instead of multiple clausestoonn2020-07-054-9/+9
| | | |
| * | | Adjust comment indentationtoonn2020-07-051-7/+7
| | | |
| * | | Drop unnecessary if-expressionstoonn2020-07-053-5/+6
| | | |
| * | | Use in instead of multiple equality clausestoonn2020-07-052-6/+6
| | | |
| * | | Drop unnecessary comprehensionstoonn2020-07-052-7/+3
| | | | | | | | | | | | | | | | | | | | It's unclear why these comprehensions were used, maybe as a way of cloning the lists? However, this does not seem necessary.
| * | | Drop redundant try-excepttoonn2020-07-051-4/+2
| | | |
| * | | Switch to testing after lower casing for consistencytoonn2020-07-051-2/+2
| | | |
| * | | Drop redundant pass statementstoonn2020-07-053-11/+0
| | | | | | | | | | | | | | | | | | | | Because of the docstrings the function bodies aren't empty and pass is not required.
| * | | Add local pylint disablestoonn2020-07-053-2/+4
| | | |
| * | | Disable dict-comprehension suggestiontoonn2020-07-051-0/+2
| | | | | | | | | | | | | | | | | | | | Dict comprehensions were add in 2.7 so we can't use them for COMPAT reasons.
| * | | Disable spurious warning, name is obviously passedtoonn2020-07-051-0/+1
| | | |
| * | | Replace if statement with dict.get with defaulttoonn2020-07-051-8/+2
| | | |
| * | | Add global Pylint ignorestoonn2020-07-052-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `no-else-break/continue/raise/return` because they're nonsense and result in actively less readable code. `useless-object-inheritance` because that's a py3-ism. `import-outside-toplevel` because we use this in many places to good effect.
| * | | Prepare for Pylint transition from versions <2toonn2020-07-055-40/+17
|/ / /
* | | Merge branch 'touch-recursive'toonn2020-07-051-1/+5
|\ \ \
| * | | :touch create missing directoriestoonn2020-06-161-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `:mkdir` creates directories recursively like `mkdir -p`. `:touch` failed when parent directories didn't exist, for convenience and consistency it now creates missing directories recursively. Fixes #1998
* | | | Merge branch 'color-line-numbers'toonn2020-07-055-5/+16
|\ \ \ \
| * | | | Implement a line_number context for colorschemestoonn2020-04-095-5/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Changes the default color for line numbers to differ from the file's color to the terminal's base foreground color in the default theme. Green in the jungle theme and bold and/or bright in the snow theme. Fixes #1906
* | | | | Merge branch 'py-version-checks'toonn2020-07-0513-37/+34
|\ \ \ \ \
| * | | | | Factor out python 3 version checkingtoonn2020-06-2912-37/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We check whether we're running python 2 or 3 in many places. In some places we do more specific version checks but with the new `PY3` constant modeled after `six` this code should be slightly more readable.
| * | | | | Factor PY3 constant out into ranger moduletoonn2020-06-293-5/+5
| | | | | |
* | | | | | Merge branch 'rc_macro_error'toonn2020-07-052-68/+121
|\ \ \ \ \ \
| * | | | | | Add MacroDicttoonn2019-09-272-67/+120
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Macros are resolved for set commands. A contributor wanted to add a setting for a date format string to be used in ranger's status bar. The string they tried happened to include `%d` which is a valid ranger macro for the name of `thisdir`. This attribute is not yet defined when ranger is reading `rc.conf` and this uncaught exception would crash ranger. To work around this we need to catch `AttributeError`s for values that might not exist yet. To avoid the repetition that'd come with all these try-catch statements that behavior has been encapsulated in a new MacroDict. This is almost as easy to use as the regular python dictionary used previously. The only difference being that we need to wrap values that might cause problems in a python `lambda`, though it doesn't do any harm to wrap values that can't raise exceptions.
| * | | | | | Catch exceptions when resolving macros in rc.conftoonn2019-07-181-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While parsing the settings in `rc.conf` `self.fm.thisfile` doesn't exist yet.
* | | | | | | Merge pull request #1816 from toonn/gifehfehWojciech Siewierski2020-07-051-1/+1
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | Feh does not handle animated gifs gracefully
| * | | | | | | Feh does not handle animated gifs gracefullytoonn2020-01-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes #1814
* | | | | | | | Merge pull request #1847 from toonn/rust-is-textWojciech Siewierski2020-07-051-5/+5
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | Add rust to programming languages for rifle
| * | | | | | | | Add rust to programming languages for rifletoonn2020-02-211-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add the Rust extension `.rs` to the list of programming languages to match editor and pager because it is erroneously guessed as being `application/rls-services+xml`.
* | | | | | | | | Merge branch 'cache-hash' [#2019]Wojciech Siewierski2020-07-051-11/+9
|\ \ \ \ \ \ \ \ \ | | |_|_|_|_|_|/ / | |/| | | | | | |