Skip to content

Commit

Permalink
feat: ALT+A to deselect all files (#263)
Browse files Browse the repository at this point in the history
  • Loading branch information
veeso authored Jul 8, 2024
1 parent b5b3aeb commit f3b84c9
Show file tree
Hide file tree
Showing 11 changed files with 44 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions docs/de/man.md
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ In order to change panel you need to type `<LEFT>` to move the remote explorer p
| `<Y>` | Toggle synchronized browsing | sYnc |
| `<Z>` | Change file mode | |
| `<CTRL+A>` | Select all files | |
| `<ALT+A>` | Deselect all files | |
| `<CTRL+C>` | Abort file transfer process | |
| `<CTRL+T>` | Show all synchronized paths | Track |

Expand Down
1 change: 1 addition & 0 deletions docs/es/man.md
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ Para cambiar de panel, debe escribir `<LEFT>` para mover el panel del explorador
| `<Y>` | Alternar navegación sincronizada | sYnc |
| `<Z>` | Cambiar ppermisos de archivo | |
| `<CTRL+A>` | Seleccionar todos los archivos | |
| `<ALT+A>` | Deseleccionar todos los archivos | |
| `<CTRL+C>` | Abortar el proceso de transferencia de archivos | |
| `<CTRL+T>` | Mostrar todas las rutas sincronizadas | Track |

Expand Down
1 change: 1 addition & 0 deletions docs/fr/man.md
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ Pour changer de panneau, vous devez taper `<LEFT>` pour déplacer le panneau de
| `<Y>` | Basculer la navigation synchronisée | sYnc |
| `<Z>` | Changer permissions de fichier | |
| `<CTRL+A>` | Sélectionner tous les fichiers | |
| `<ALT+A>` | Desélectionner tous les fichiers | |
| `<CTRL+C>` | Abandonner le processus de transfert de fichiers | |
| `<CTRL+T>` | Afficher tous les chemins synchronisés | Track |

Expand Down
1 change: 1 addition & 0 deletions docs/it/man.md
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ Per cambiare pannello ti puoi muovere con le frecce, `<LEFT>` per andare sul pan
| `<Y>` | Abilita/disabilita Sync-Browsing | sYnc |
| `<Z>` | Modifica permessi file | |
| `<CTRL+A>` | Seleziona tutti i file | |
| `<ALT+A>` | Deseleziona tutti i file | |
| `<CTRL+C>` | Annulla trasferimento file | |
| `<CTRL+T>` | Visualizza tutti i percorsi sincronizzati | Track |

Expand Down
1 change: 1 addition & 0 deletions docs/man.md
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ In order to change panel you need to type `<LEFT>` to move the remote explorer p
| `<Y>` | Toggle synchronized browsing | sYnc |
| `<Z>` | Change file mode | |
| `<CTRL+A>` | Select all files | |
| `<ALT+A>` | Deselect all files | |
| `<CTRL+C>` | Abort file transfer process | |
| `<CTRL+T>` | Show all synchronized paths | Track |

Expand Down
5 changes: 3 additions & 2 deletions docs/ptbr/man.md
Original file line number Diff line number Diff line change
Expand Up @@ -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-)
Expand Down Expand Up @@ -258,6 +258,7 @@ Para trocar de painel, você precisa pressionar `<LEFT>` para mover para o paine
| `<Y>` | Alternar navegação sincronizada | Sincronizar |
| `<Z>` | Alterar modo de arquivo | |
| `<CTRL+A>` | Selecionar todos os arquivos | |
| `<ALT+A>` | Deselecionar todos os arquivos | |
| `<CTRL+C>` | Abortir processo de transferência de arquivo | |
| `<CTRL+T>` | Mostrar todos os caminhos sincronizados | Track |

Expand Down
1 change: 1 addition & 0 deletions docs/zh-CN/man.md
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ termscp中的文件资源管理器是指你与远程建立连接后可以看到
| `<Y>` | 是否开启同步浏览 | sYnc |
| `<Z>` | 更改文件权限 | |
| `<CTRL+A>` | 选中所有文件 | |
| `<ALT+A>` | 取消选择所有文件 | |
| `<CTRL+C>` | 终止文件传输 | |
| `<CTRL+T>` | 显示所有同步路径 | Track |

Expand Down
3 changes: 3 additions & 0 deletions src/ui/activities/filetransfer/components/popups.rs
Original file line number Diff line number Diff line change
Expand Up @@ -796,6 +796,9 @@ impl KeybindingsPopup {
.add_col(TextSpan::new("<CTRL+A>").bold().fg(key_color))
.add_col(TextSpan::from(" Select all files"))
.add_row()
.add_col(TextSpan::new("<ALT+A>").bold().fg(key_color))
.add_col(TextSpan::from(" Deselect all files"))
.add_row()
.add_col(TextSpan::new("<CTRL+C>").bold().fg(key_color))
.add_col(TextSpan::from(" Interrupt file transfer"))
.add_row()
Expand Down
10 changes: 10 additions & 0 deletions src/ui/activities/filetransfer/components/transfer/file_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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
Expand Down
21 changes: 21 additions & 0 deletions src/ui/activities/filetransfer/components/transfer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,13 @@ impl Component<Msg, NoUserEvent> 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,
Expand Down Expand Up @@ -198,6 +205,13 @@ impl Component<Msg, NoUserEvent> 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,
Expand Down Expand Up @@ -383,6 +397,13 @@ impl Component<Msg, NoUserEvent> 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,
Expand Down

0 comments on commit f3b84c9

Please sign in to comment.