From e23e8b204beda5e2fe27e75e57c966315ff6a62d Mon Sep 17 00:00:00 2001 From: veeso Date: Mon, 8 Jul 2024 15:50:50 +0200 Subject: [PATCH] feat: ALT+A to deselect all files --- CHANGELOG.md | 1 + docs/de/man.md | 1 + docs/es/man.md | 1 + docs/fr/man.md | 1 + docs/it/man.md | 1 + docs/man.md | 1 + docs/ptbr/man.md | 5 +++-- docs/zh-CN/man.md | 1 + .../filetransfer/components/popups.rs | 3 +++ .../components/transfer/file_list.rs | 10 +++++++++ .../filetransfer/components/transfer/mod.rs | 21 +++++++++++++++++++ 11 files changed, 44 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 13a2d895..ff4e300b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -41,6 +41,7 @@ Released on ?? - [Issue 241](https://github.com/veeso/termscp/issues/241): Jump to next entry after select +- [Issue 255](https://github.com/veeso/termscp/issues/255): New keybindings `Ctrl + Shift + A` to deselect all files - [Issue 257](https://github.com/veeso/termscp/issues/257): CLI remote args cannot handle '@' in the username ## 0.13.0 diff --git a/docs/de/man.md b/docs/de/man.md index 5cb285bc..50e80f9e 100644 --- a/docs/de/man.md +++ b/docs/de/man.md @@ -244,6 +244,7 @@ In order to change panel you need to type `` to move the remote explorer p | `` | Toggle synchronized browsing | sYnc | | `` | Change file mode | | | `` | Select all files | | +| `` | Deselect all files | | | `` | Abort file transfer process | | | `` | Show all synchronized paths | Track | diff --git a/docs/es/man.md b/docs/es/man.md index 69f0ec0a..207ee9aa 100644 --- a/docs/es/man.md +++ b/docs/es/man.md @@ -245,6 +245,7 @@ Para cambiar de panel, debe escribir `` para mover el panel del explorador | `` | Alternar navegación sincronizada | sYnc | | `` | Cambiar ppermisos de archivo | | | `` | Seleccionar todos los archivos | | +| `` | Deseleccionar todos los archivos | | | `` | Abortar el proceso de transferencia de archivos | | | `` | Mostrar todas las rutas sincronizadas | Track | diff --git a/docs/fr/man.md b/docs/fr/man.md index 8a8619e1..48d41b5d 100644 --- a/docs/fr/man.md +++ b/docs/fr/man.md @@ -244,6 +244,7 @@ Pour changer de panneau, vous devez taper `` pour déplacer le panneau de | `` | Basculer la navigation synchronisée | sYnc | | `` | Changer permissions de fichier | | | `` | Sélectionner tous les fichiers | | +| `` | Desélectionner tous les fichiers | | | `` | Abandonner le processus de transfert de fichiers | | | `` | Afficher tous les chemins synchronisés | Track | diff --git a/docs/it/man.md b/docs/it/man.md index bf823c65..086166ad 100644 --- a/docs/it/man.md +++ b/docs/it/man.md @@ -240,6 +240,7 @@ Per cambiare pannello ti puoi muovere con le frecce, `` per andare sul pan | `` | Abilita/disabilita Sync-Browsing | sYnc | | `` | Modifica permessi file | | | `` | Seleziona tutti i file | | +| `` | Deseleziona tutti i file | | | `` | Annulla trasferimento file | | | `` | Visualizza tutti i percorsi sincronizzati | Track | diff --git a/docs/man.md b/docs/man.md index a3bb8dca..e1641fb7 100644 --- a/docs/man.md +++ b/docs/man.md @@ -256,6 +256,7 @@ In order to change panel you need to type `` to move the remote explorer p | `` | Toggle synchronized browsing | sYnc | | `` | Change file mode | | | `` | Select all files | | +| `` | Deselect all files | | | `` | Abort file transfer process | | | `` | Show all synchronized paths | Track | diff --git a/docs/ptbr/man.md b/docs/ptbr/man.md index ef7d5b8b..1d570a26 100644 --- a/docs/ptbr/man.md +++ b/docs/ptbr/man.md @@ -15,13 +15,13 @@ - [Explorador de Arquivos 📂](#explorador-de-arquivos-) - [Atalhos de Teclado ⌨](#atalhos-de-teclado-) - [Trabalhar com Vários Arquivos 🥷](#trabalhar-com-vários-arquivos-) - - [Navegação Sincronizada ⏲️](#navegação-sincronizada-) + - [Navegação Sincronizada ⏲️](#navegação-sincronizada-️) - [Abrir e Abrir Com 🚪](#abrir-e-abrir-com-) - [Favoritos ⭐](#favoritos-) - [Minhas Senhas São Seguras? 😈](#minhas-senhas-são-seguras-) - [Keyring do Linux](#keyring-do-linux) - [Configuração do KeepassXC para o termscp](#configuração-do-keepassxc-para-o-termscp) - - [Configuração ⚙️](#configuração-) + - [Configuração ⚙️](#configuração-️) - [Armazenamento de Chave SSH 🔐](#armazenamento-de-chave-ssh-) - [Formato do Explorador de Arquivos](#formato-do-explorador-de-arquivos) - [Temas 🎨](#temas-) @@ -258,6 +258,7 @@ Para trocar de painel, você precisa pressionar `` para mover para o paine | `` | Alternar navegação sincronizada | Sincronizar | | `` | Alterar modo de arquivo | | | `` | Selecionar todos os arquivos | | +| `` | Deselecionar todos os arquivos | | | `` | Abortir processo de transferência de arquivo | | | `` | Mostrar todos os caminhos sincronizados | Track | diff --git a/docs/zh-CN/man.md b/docs/zh-CN/man.md index 16245f6a..2cbc0b12 100644 --- a/docs/zh-CN/man.md +++ b/docs/zh-CN/man.md @@ -240,6 +240,7 @@ termscp中的文件资源管理器是指你与远程建立连接后可以看到 | `` | 是否开启同步浏览 | sYnc | | `` | 更改文件权限 | | | `` | 选中所有文件 | | +| `` | 取消选择所有文件 | | | `` | 终止文件传输 | | | `` | 显示所有同步路径 | Track | diff --git a/src/ui/activities/filetransfer/components/popups.rs b/src/ui/activities/filetransfer/components/popups.rs index 812a6957..d67d2d67 100644 --- a/src/ui/activities/filetransfer/components/popups.rs +++ b/src/ui/activities/filetransfer/components/popups.rs @@ -796,6 +796,9 @@ impl KeybindingsPopup { .add_col(TextSpan::new("").bold().fg(key_color)) .add_col(TextSpan::from(" Select all files")) .add_row() + .add_col(TextSpan::new("").bold().fg(key_color)) + .add_col(TextSpan::from(" Deselect all files")) + .add_row() .add_col(TextSpan::new("").bold().fg(key_color)) .add_col(TextSpan::from(" Interrupt file transfer")) .add_row() diff --git a/src/ui/activities/filetransfer/components/transfer/file_list.rs b/src/ui/activities/filetransfer/components/transfer/file_list.rs index 2a92097d..2ea17553 100644 --- a/src/ui/activities/filetransfer/components/transfer/file_list.rs +++ b/src/ui/activities/filetransfer/components/transfer/file_list.rs @@ -12,6 +12,7 @@ use tuirealm::tui::widgets::{List as TuiList, ListItem, ListState}; use tuirealm::{MockComponent, Props, State, StateValue}; pub const FILE_LIST_CMD_SELECT_ALL: &str = "A"; +pub const FILE_LIST_CMD_DESELECT_ALL: &str = "D"; /// OwnStates contains states for this component #[derive(Clone, Default)] @@ -113,6 +114,11 @@ impl OwnStates { } } + /// Select all files + pub fn deselect_all(&mut self) { + self.selected.clear(); + } + /// Select provided index if not selected yet fn select(&mut self, entry: usize) { if !self.is_selected(entry) { @@ -332,6 +338,10 @@ impl MockComponent for FileList { self.states.select_all(); CmdResult::None } + Cmd::Custom(FILE_LIST_CMD_DESELECT_ALL) => { + self.states.deselect_all(); + CmdResult::None + } Cmd::Toggle => { self.states.toggle_file(self.states.list_index()); CmdResult::None diff --git a/src/ui/activities/filetransfer/components/transfer/mod.rs b/src/ui/activities/filetransfer/components/transfer/mod.rs index df6b3053..de89c5d4 100644 --- a/src/ui/activities/filetransfer/components/transfer/mod.rs +++ b/src/ui/activities/filetransfer/components/transfer/mod.rs @@ -73,6 +73,13 @@ impl Component for ExplorerFind { let _ = self.perform(Cmd::Custom(file_list::FILE_LIST_CMD_SELECT_ALL)); Some(Msg::None) } + Event::Keyboard(KeyEvent { + code: Key::Char('a'), + modifiers: KeyModifiers::ALT, + }) => { + let _ = self.perform(Cmd::Custom(file_list::FILE_LIST_CMD_DESELECT_ALL)); + Some(Msg::None) + } Event::Keyboard(KeyEvent { code: Key::Char('m'), modifiers: KeyModifiers::NONE, @@ -198,6 +205,13 @@ impl Component for ExplorerLocal { let _ = self.perform(Cmd::Custom(file_list::FILE_LIST_CMD_SELECT_ALL)); Some(Msg::None) } + Event::Keyboard(KeyEvent { + code: Key::Char('a'), + modifiers: KeyModifiers::ALT, + }) => { + let _ = self.perform(Cmd::Custom(file_list::FILE_LIST_CMD_DESELECT_ALL)); + Some(Msg::None) + } Event::Keyboard(KeyEvent { code: Key::Char('m'), modifiers: KeyModifiers::NONE, @@ -383,6 +397,13 @@ impl Component for ExplorerRemote { let _ = self.perform(Cmd::Custom(file_list::FILE_LIST_CMD_SELECT_ALL)); Some(Msg::None) } + Event::Keyboard(KeyEvent { + code: Key::Char('a'), + modifiers: KeyModifiers::ALT, + }) => { + let _ = self.perform(Cmd::Custom(file_list::FILE_LIST_CMD_DESELECT_ALL)); + Some(Msg::None) + } Event::Keyboard(KeyEvent { code: Key::Char('m'), modifiers: KeyModifiers::NONE,