diff options
author | DLFW <daniel@llin.info> | 2022-08-30 19:46:22 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-30 13:46:22 -0400 |
commit | 826e24eaf4a10921bdd087079c4d7330896b79c2 (patch) | |
tree | ecce44e4243f7b58d110e071759a5ec32c6be2fb /src/key_command/command.rs | |
parent | edf620b4aceaaadffedd14d85d120d485a6ad8f3 (diff) |
Add "Visual-Mode" (#192)
* Add "Visual-Mode"
This adds a "visual-mode" file selection feature where a range-selection follows the file-cursor.
Description of usage is added to the docs.
Also, the "normal" and the new "visual-mode-selection" are now preserved
when a `DirList` is reloaded.
Wrap-up of changes:
* Add command `toggle_visual`, mapped to `V`
* Add command `escape`, mapped to `ESCAPE`
* Add style `[visual_mode_selection]` for file entries which are
"temporarily" selected by visual-mode
* For `JoshutoDirEntry`, the attribute `selected` has been renamed to
`permanent_selected`, and a second selection-attribute
`visual_mode_selected` has been added. "Setters" and "getters" have
been adapted/added accordingly. The former "getter" for the `selecetd`
attribute still exists and returns `True` for an entry which is
"permanant selected" _or_ "visual-mode selected". So any higher logic
which acts on selected files does not need to care about "how" and
entry is selected.
* Each `JoshutoDirList` has an optional index of the file where
visual-mode has been entered and re-calculates the "visual-mode
selecetd" status for each entry any time the cursor-index changes.
* The footer has been extended so it shows a "VIS" marker when the user
is in visual-mode.
This implementation of visual-mode is a bit different from the ranger
one, where the visual-selection is turned into a "normal selection" when
a command (like `copy-files`) is issued. This implementation keeps
both selections separate until the user toggles back to "normal mode".
Only then the visual-selection is taken over to the "normal selection".
The user also can withdraw the visual-selection with `escape`.
The `escape` command may be used also for other "reset"-actions in the
future.
* fix syntax for Rust stable
* cargo clippy
Diffstat (limited to 'src/key_command/command.rs')
-rw-r--r-- | src/key_command/command.rs | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/key_command/command.rs b/src/key_command/command.rs index 9ffbe5c..6c698ea 100644 --- a/src/key_command/command.rs +++ b/src/key_command/command.rs @@ -7,6 +7,8 @@ use crate::io::FileOperationOptions; #[derive(Clone, Debug)] #[allow(clippy::enum_variant_names)] pub enum Command { + Escape, + ToggleVisualMode, BulkRename, ChangeDirectory(path::PathBuf), |