diff --git a/CHANGELOG.md b/CHANGELOG.md index 1bca34a..a840fd5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -38,6 +38,18 @@ Released on FIXME: - **Ui**: - Transfer abortion is now more responsive - Selected files will now be rendered with **Reversed, underlined and italic** text modifiers instead of being prepended with `*`. + - **Midnight commander keys** + - ``: Show help + - ``: View file + - ``: Open file (with text editor) + - ``: Copy file + - ``: Rename file + - ``: Make directory + - ``: Remove file + - ``: Quit + - Added footer with most used key bindings + - ❗ `` will now switch explorer tab (will do what `` and `` currently do) + - ❗ Use `` to switch between explorer tab and log tab. ❗ Backtab is `` - **Tui-realm migration**: - migrated application to tui-realm 1.x - Improved application performance diff --git a/docs/de/man.md b/docs/de/man.md index 53f047c..0a1d753 100644 --- a/docs/de/man.md +++ b/docs/de/man.md @@ -149,8 +149,8 @@ In order to change panel you need to type `` to move the remote explorer p | Key | Command | Reminder | |---------------|-------------------------------------------------------|-------------| | `` | Disconnect from remote; return to authentication page | | -| `` | Switch between log tab and explorer | | | `` | Go to previous directory in stack | | +| `` | Switch explorer tab | | | `` | Move to remote explorer tab | | | `` | Move to local explorer tab | | | `` | Move up in selected list | | @@ -159,28 +159,28 @@ In order to change panel you need to type `` to move the remote explorer p | `` | Move down in selected list by 8 rows | | | `` | Enter directory | | | `` | Upload / download selected file | | +| `` | Switch between log tab and explorer | | | `` | Toggle hidden files | All | | `` | Sort files by | Bubblesort? | -| `` | Copy file/directory | Copy | -| `` | Make directory | Directory | -| `` | Delete file (Same as `DEL`) | Erase | +| `` | Copy file/directory | Copy | +| `` | Make directory | Directory | +| `` | Delete file | Erase | | `` | Search for files (wild match is supported) | Find | | `` | Go to supplied path | Go to | -| `` | Show help | Help | +| `` | Show help | Help | | `` | Show info about selected file or directory | Info | | `` | Reload current directory's content / Clear selection | List | | `` | Select a file | Mark | | `` | Create new file with provided name | New | -| `` | Edit file; see Text editor | Open | -| `` | Quit termscp | Quit | -| `` | Rename file | Rename | +| `` | Edit file; see Text editor | Open | +| `` | Quit termscp | Quit | +| `` | Rename file | Rename | | `` | Save file as... | Save | | `` | Go to parent directory | Upper | -| `` | Open file with default program for filetype | View | +| `` | Open file with default program for filetype | View | | `` | Open file with provided program | With | | `` | Execute a command | eXecute | | `` | Toggle synchronized browsing | sYnc | -| `` | Delete file | | | `` | Select all files | | | `` | Abort file transfer process | | diff --git a/docs/es/man.md b/docs/es/man.md index 91beaae..cf627bf 100644 --- a/docs/es/man.md +++ b/docs/es/man.md @@ -149,8 +149,8 @@ Para cambiar de panel, debe escribir `` para mover el panel del explorador | Key | Command | Reminder | |---------------|-------------------------------------------------------|-------------| | `` | Desconecte; volver a la página de autenticación | | -| `` | Cambiar entre la pestaña de registro y el explorador | | | `` | Ir al directorio anterior en la pila | | +| `` | Cambiar pestaña del explorador | | | `` | Mover a la pestaña del explorador remoto | | | `` | Mover a la pestaña del explorador local | | | `` | Subir en la lista seleccionada | | @@ -159,28 +159,28 @@ Para cambiar de panel, debe escribir `` para mover el panel del explorador | `` | Bajar 8 filas en la lista seleccionada | | | `` | Entrar directorio | | | `` | Cargar / descargar el archivo seleccionado | | +| `` | Cambiar entre la pestaña de registro y el explorador | | | `` | Alternar archivos ocultos | All | | `` | Ordenar archivos por | Bubblesort? | -| `` | Copiar archivo / directorio | Copy | -| `` | Hacer directorio | Directory | -| `` | Eliminar archivo (igual que `DEL`) | Erase | +| `` | Copiar archivo / directorio | Copy | +| `` | Hacer directorio | Directory | +| `` | Eliminar archivo | Erase | | `` | Búsqueda de archivos | Find | | `` | Ir a la ruta proporcionada | Go to | -| `` | Mostrar ayuda | Help | +| `` | Mostrar ayuda | Help | | `` | Mostrar información sobre el archivo | Info | | `` | Recargar contenido del directorio / Borrar selección | List | | `` | Seleccione un archivo | Mark | | `` | Crear un nuevo archivo con el nombre proporcionado | New | -| `` | Editar archivo | Open | -| `` | Salir de termscp | Quit | -| `` | Renombrar archivo | Rename | +| `` | Editar archivo | Open | +| `` | Salir de termscp | Quit | +| `` | Renombrar archivo | Rename | | `` | Guardar archivo como... | Save | | `` | Ir al directorio principal | Upper | -| `` | Abrir archivo con el programa predeterminado | View | +| `` | Abrir archivo con el programa predeterminado | View | | `` | Abrir archivo con el programa proporcionado | With | | `` | Ejecutar un comando | eXecute | | `` | Alternar navegación sincronizada | sYnc | -| `` | Eliminar archivo | | | `` | Seleccionar todos los archivos | | | `` | Abortar el proceso de transferencia de archivos | | diff --git a/docs/fr/man.md b/docs/fr/man.md index ee26fa6..6252d25 100644 --- a/docs/fr/man.md +++ b/docs/fr/man.md @@ -147,8 +147,8 @@ Pour changer de panneau, vous devez taper `` pour déplacer le panneau de | Key | Command | Reminder | |---------------|---------------------------------------------------------------------|-------------| | `` | Se Déconnecter de le serveur; retour à la page d'authentification | | -| `` | Basculer entre l'onglet journal et l'explorateur | | | `` | Aller au répertoire précédent dans la pile | | +| `` | Changer d'onglet explorateur | | | `` | Déplacer vers l'onglet explorateur distant | | | `` | Déplacer vers l'onglet explorateur local | | | `` | Remonter dans la liste sélectionnée | | @@ -157,28 +157,28 @@ Pour changer de panneau, vous devez taper `` pour déplacer le panneau de | `` | Descendre dans la liste sélectionnée de 8 lignes | | | `` | Entrer dans le directoire | | | `` | Télécharger le fichier sélectionné | | +| `` | Basculer entre l'onglet journal et l'explorateur | | | `` | Basculer les fichiers cachés | All | | `` | Trier les fichiers par | Bubblesort? | -| `` | Copier le fichier/répertoire | Copy | -| `` | Créer un dossier | Directory | -| `` | Supprimer le fichier (Identique à `DEL`) | Erase | +| `` | Copier le fichier/répertoire | Copy | +| `` | Créer un dossier | Directory | +| `` | Supprimer le fichier (Identique à `DEL`) | Erase | | `` | Rechercher des fichiers | Find | | `` | Aller au chemin fourni | Go to | -| `` | Afficher l'aide | Help | +| `` | Afficher l'aide | Help | | `` | Afficher les informations sur le fichier ou le dossier sélectionné | Info | | `` | Recharger le contenu du répertoire actuel / Effacer la sélection | List | | `` | Sélectionner un fichier | Mark | | `` | Créer un nouveau fichier avec le nom fourni | New | -| `` | Modifier le fichier | Open | -| `` | Quitter termscp | Quit | -| `` | Renommer le fichier | Rename | +| `` | Modifier le fichier | Open | +| `` | Quitter termscp | Quit | +| `` | Renommer le fichier | Rename | | `` | Enregistrer le fichier sous... | Save | | `` | Aller dans le répertoire parent | Upper | -| `` | Ouvrir le fichier avec le programme défaut pour le type de fichier | View | +| `` | Ouvrir le fichier avec le programme défaut pour le type de fichier | View | | `` | Ouvrir le fichier avec le programme spécifié | With | | `` | Exécuter une commande | eXecute | | `` | Basculer la navigation synchronisée | sYnc | -| `` | Supprimer le fichier | | | `` | Sélectionner tous les fichiers | | | `` | Abandonner le processus de transfert de fichiers | | diff --git a/docs/it/man.md b/docs/it/man.md index 90521da..4789d7b 100644 --- a/docs/it/man.md +++ b/docs/it/man.md @@ -143,8 +143,8 @@ Per cambiare pannello ti puoi muovere con le frecce, `` per andare sul pan | Key | Command | Reminder | |---------------|-------------------------------------------------------|-------------| | `` | Disconnettiti; chiudi popup | | -| `` | Cambia tra explorer e pannello di log | | | `` | Vai alla directory precedente | | +| `` | Cambia pannello remoto | | | `` | Vai al pannello remoto | | | `` | Vai al pannello locale | | | `` | Muovi il cursore verso l'alto | | @@ -153,28 +153,28 @@ Per cambiare pannello ti puoi muovere con le frecce, `` per andare sul pan | `` | Muovi il cursore verso il basso di 8 | | | `` | Entra nella directory | | | `` | Upload / download file selezionato/i | | +| `` | Cambia tra explorer e pannello di log | | | `` | Mostra/nascondi file nascosti | All | | `` | Ordina file per | Bubblesort? | -| `` | Copia file/directory | Copy | -| `` | Crea directory | Directory | -| `` | Elimina file (Come `DEL`) | Erase | +| `` | Copia file/directory | Copy | +| `` | Crea directory | Directory | +| `` | Elimina file | Erase | | `` | Cerca file (wild match supportato) | Find | | `` | Vai al percorso indicato | Go to | -| `` | Mostra help | Help | +| `` | Mostra help | Help | | `` | Mostra informazioni per il file selezionato | Info | | `` | Ricarica posizione corrente / pulisci selezione file | List | | `` | Seleziona file | Mark | | `` | Crea nuovo file con il nome fornito | New | -| `` | Modifica file; Vedi text editor | Open | -| `` | Termina termscp | Quit | -| `` | Rinomina file | Rename | +| `` | Modifica file; Vedi text editor | Open | +| `` | Termina termscp | Quit | +| `` | Rinomina file | Rename | | `` | Salva file con nome | Save | | `` | Vai alla directory padre | Upper | -| `` | Apri il file con il programma definito dal sistema | View | +| `` | Apri il file con il programma definito dal sistema | View | | `` | Apri il file con il programma specificato | With | | `` | Esegui comando shell | eXecute | | `` | Abilita/disabilita Sync-Browsing | sYnc | -| `` | Rimuovi file | | | `` | Seleziona tutti i file | | | `` | Annulla trasferimento file | | diff --git a/docs/man.md b/docs/man.md index 8900391..c782937 100644 --- a/docs/man.md +++ b/docs/man.md @@ -147,8 +147,8 @@ In order to change panel you need to type `` to move the remote explorer p | Key | Command | Reminder | |---------------|-------------------------------------------------------|-------------| | `` | Disconnect from remote; return to authentication page | | -| `` | Switch between log tab and explorer | | | `` | Go to previous directory in stack | | +| `` | Switch explorer tab | | | `` | Move to remote explorer tab | | | `` | Move to local explorer tab | | | `` | Move up in selected list | | @@ -157,28 +157,28 @@ In order to change panel you need to type `` to move the remote explorer p | `` | Move down in selected list by 8 rows | | | `` | Enter directory | | | `` | Upload / download selected file | | +| `` | Switch between log tab and explorer | | | `` | Toggle hidden files | All | | `` | Sort files by | Bubblesort? | -| `` | Copy file/directory | Copy | -| `` | Make directory | Directory | -| `` | Delete file (Same as `DEL`) | Erase | +| `` | Copy file/directory | Copy | +| `` | Make directory | Directory | +| `` | Delete file | Erase | | `` | Search for files (wild match is supported) | Find | | `` | Go to supplied path | Go to | -| `` | Show help | Help | +| `` | Show help | Help | | `` | Show info about selected file or directory | Info | | `` | Reload current directory's content / Clear selection | List | | `` | Select a file | Mark | | `` | Create new file with provided name | New | -| `` | Edit file; see Text editor | Open | -| `` | Quit termscp | Quit | -| `` | Rename file | Rename | +| `` | Edit file; see Text editor | Open | +| `` | Quit termscp | Quit | +| `` | Rename file | Rename | | `` | Save file as... | Save | | `` | Go to parent directory | Upper | -| `` | Open file with default program for filetype | View | +| `` | Open file with default program for filetype | View | | `` | Open file with provided program | With | | `` | Execute a command | eXecute | | `` | Toggle synchronized browsing | sYnc | -| `` | Delete file | | | `` | Select all files | | | `` | Abort file transfer process | | diff --git a/docs/zh-CN/man.md b/docs/zh-CN/man.md index 13c274d..d19e64e 100644 --- a/docs/zh-CN/man.md +++ b/docs/zh-CN/man.md @@ -145,8 +145,8 @@ termscp中的文件资源管理器是指你与远程建立连接后可以看到 | 按键 | 命令 | 助记词 | |---------------|-------------------------------------------------------|-------------| | `` | 断开远程连接;回到登录页 | | -| `` | 在日志面板和管理器面板之间切换 | | | `` | 返回上一次目录 | | +| `` | 切换资源管理器选项卡 | | | `` | 切换到远程管理器面板 | | | `` | 切换到本地管理器面板 | | | `` | 在当前列表中向上移动光标 | | @@ -155,28 +155,28 @@ termscp中的文件资源管理器是指你与远程建立连接后可以看到 | `` | 在当前列表中光标下移8行 | | | `` | 进入文件夹 | | | `` | 上传 / 下载选中文件 | | +| `` | 在日志面板和管理器面板之间切换 | | | `` | 是否显示隐藏文件 | All | | `` | 按..排序 | Bubblesort? | -| `` | 复制文件(夹) | Copy | -| `` | 创建文件夹 | Directory | -| `` | 删除文件(同 `DEL`) | Erase | +| `` | 复制文件(夹) | Copy | +| `` | 创建文件夹 | Directory | +| `` | 删除文件 | Erase | | `` | 文件搜索 (支持通配符) | Find | | `` | 跳转到指定路径 | Go to | -| `` | 显示帮助 | Help | +| `` | 显示帮助 | Help | | `` | 显示选中文件(夹)信息 | Info | | `` | 刷新当前目录列表 / 清除选中状态 | List | | `` | 选中文件 | Mark | | `` | 使用键入的名称新建文件 | New | -| `` | 编辑文件;参考文本编辑器文档 | Open | -| `` | 退出termscp | Quit | -| `` | 重命名文件 | Rename | +| `` | 编辑文件;参考文本编辑器文档 | Open | +| `` | 退出termscp | Quit | +| `` | 重命名文件 | Rename | | `` | 另存为... | Save | | `` | 进入上层目录 | Upper | -| `` | 使用默认方式打开文件 | View | +| `` | 使用默认方式打开文件 | View | | `` | 使用指定程序打开文件 | With | | `` | 运行命令 | eXecute | | `` | 是否开启同步浏览 | sYnc | -| `` | 删除文件 | | | `` | 选中所有文件 | | | `` | 终止文件传输 | | diff --git a/src/ui/activities/filetransfer/components/log.rs b/src/ui/activities/filetransfer/components/log.rs index 540261f..ba1625b 100644 --- a/src/ui/activities/filetransfer/components/log.rs +++ b/src/ui/activities/filetransfer/components/log.rs @@ -62,10 +62,10 @@ impl MockComponent for Log { .props .get_or(Attribute::Focus, AttrValue::Flag(false)) .unwrap_flag(); - let fg = self + let borders = self .props - .get_or(Attribute::Foreground, AttrValue::Color(Color::Reset)) - .unwrap_color(); + .get_or(Attribute::Borders, AttrValue::Borders(Borders::default())) + .unwrap_borders(); let bg = self .props .get_or(Attribute::Background, AttrValue::Color(Color::Reset)) @@ -81,7 +81,7 @@ impl MockComponent for Log { .collect(); let w = TuiList::new(list_items) .block(tui_realm_stdlib::utils::get_block( - Borders::default().color(fg), + borders, Some(("Log".to_string(), Alignment::Left)), focus, None, @@ -214,7 +214,9 @@ impl Component for Log { Some(Msg::None) } // -- comp msg - Event::Keyboard(KeyEvent { code: Key::Tab, .. }) => Some(Msg::Ui(UiMsg::LogTabbed)), + Event::Keyboard(KeyEvent { + code: Key::BackTab, .. + }) => Some(Msg::Ui(UiMsg::LogBackTabbed)), _ => None, } } diff --git a/src/ui/activities/filetransfer/components/misc.rs b/src/ui/activities/filetransfer/components/misc.rs new file mode 100755 index 0000000..0b95096 --- /dev/null +++ b/src/ui/activities/filetransfer/components/misc.rs @@ -0,0 +1,74 @@ +//! ## Components +//! +//! file transfer activity components + +/** + * MIT License + * + * termscp - Copyright (c) 2021 Christian Visintin + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +use super::Msg; + +use tui_realm_stdlib::Span; +use tuirealm::props::{Color, TextSpan}; +use tuirealm::{Component, Event, MockComponent, NoUserEvent}; + +#[derive(MockComponent)] +pub struct FooterBar { + component: Span, +} + +impl FooterBar { + pub fn new(key_color: Color) -> Self { + Self { + component: Span::default().spans(&[ + TextSpan::from("").fg(key_color), + TextSpan::from(" Help "), + TextSpan::from("").fg(key_color), + TextSpan::from(" Change tab "), + TextSpan::from("").fg(key_color), + TextSpan::from(" Transfer "), + TextSpan::from("").fg(key_color), + TextSpan::from(" Enter dir "), + TextSpan::from("").fg(key_color), + TextSpan::from(" View "), + TextSpan::from("").fg(key_color), + TextSpan::from(" Edit "), + TextSpan::from("").fg(key_color), + TextSpan::from(" Copy "), + TextSpan::from("").fg(key_color), + TextSpan::from(" Rename "), + TextSpan::from("").fg(key_color), + TextSpan::from(" Make dir "), + TextSpan::from("").fg(key_color), + TextSpan::from(" Make dir "), + TextSpan::from("").fg(key_color), + TextSpan::from(" Quit "), + ]), + } + } +} + +impl Component for FooterBar { + fn on(&mut self, _: Event) -> Option { + None + } +} diff --git a/src/ui/activities/filetransfer/components/mod.rs b/src/ui/activities/filetransfer/components/mod.rs index cd79cd7..6d54b4c 100644 --- a/src/ui/activities/filetransfer/components/mod.rs +++ b/src/ui/activities/filetransfer/components/mod.rs @@ -35,10 +35,12 @@ use tuirealm::{ // -- export mod log; +mod misc; mod popups; mod transfer; pub use self::log::Log; +pub use misc::FooterBar; pub use popups::{ CopyPopup, DeletePopup, DisconnectPopup, ErrorPopup, ExecPopup, FatalPopup, FileInfoPopup, FindPopup, GoToPopup, KeybindingsPopup, MkdirPopup, NewfilePopup, OpenWithPopup, @@ -59,11 +61,11 @@ impl Component for GlobalListener { Some(Msg::Ui(UiMsg::ShowDisconnectPopup)) } Event::Keyboard(KeyEvent { - code: Key::Char('q'), + code: Key::Char('q') | Key::Function(10), modifiers: KeyModifiers::NONE, }) => Some(Msg::Ui(UiMsg::ShowQuitPopup)), Event::Keyboard(KeyEvent { - code: Key::Char('h'), + code: Key::Char('h') | Key::Function(1), modifiers: KeyModifiers::NONE, }) => Some(Msg::Ui(UiMsg::ShowKeybindingsPopup)), _ => None, diff --git a/src/ui/activities/filetransfer/components/popups.rs b/src/ui/activities/filetransfer/components/popups.rs index b21a256..2084123 100644 --- a/src/ui/activities/filetransfer/components/popups.rs +++ b/src/ui/activities/filetransfer/components/popups.rs @@ -676,102 +676,106 @@ impl KeybindingsPopup { .rows( TableBuilder::default() .add_col(TextSpan::new("").bold().fg(key_color)) - .add_col(TextSpan::from(" Disconnect")) - .add_row() - .add_col(TextSpan::new("").bold().fg(key_color)) - .add_col(TextSpan::from( - " Switch between explorer and logs", - )) + .add_col(TextSpan::from(" Disconnect")) .add_row() .add_col(TextSpan::new("").bold().fg(key_color)) - .add_col(TextSpan::from(" Go to previous directory")) + .add_col(TextSpan::from(" Go to previous directory")) .add_row() - .add_col(TextSpan::new("").bold().fg(key_color)) - .add_col(TextSpan::from(" Change explorer tab")) + .add_col(TextSpan::new("").bold().fg(key_color)) + .add_col(TextSpan::from(" Change explorer tab")) .add_row() .add_col(TextSpan::new("").bold().fg(key_color)) - .add_col(TextSpan::from(" Move up/down in list")) + .add_col(TextSpan::from(" Move up/down in list")) .add_row() .add_col(TextSpan::new("").bold().fg(key_color)) - .add_col(TextSpan::from(" Enter directory")) + .add_col(TextSpan::from(" Enter directory")) .add_row() .add_col(TextSpan::new("").bold().fg(key_color)) - .add_col(TextSpan::from(" Upload/Download file")) + .add_col(TextSpan::from(" Upload/Download file")) .add_row() - .add_col(TextSpan::new("").bold().fg(key_color)) - .add_col(TextSpan::from(" Toggle hidden files")) - .add_row() - .add_col(TextSpan::new("").bold().fg(key_color)) - .add_col(TextSpan::from(" Change file sorting mode")) - .add_row() - .add_col(TextSpan::new("").bold().fg(key_color)) - .add_col(TextSpan::from(" Copy")) - .add_row() - .add_col(TextSpan::new("").bold().fg(key_color)) - .add_col(TextSpan::from(" Make directory")) - .add_row() - .add_col(TextSpan::new("").bold().fg(key_color)) - .add_col(TextSpan::from(" Search files")) - .add_row() - .add_col(TextSpan::new("").bold().fg(key_color)) - .add_col(TextSpan::from(" Go to path")) - .add_row() - .add_col(TextSpan::new("").bold().fg(key_color)) - .add_col(TextSpan::from(" Show help")) - .add_row() - .add_col(TextSpan::new("").bold().fg(key_color)) - .add_col(TextSpan::from(" Show info about selected file")) - .add_row() - .add_col(TextSpan::new("").bold().fg(key_color)) - .add_col(TextSpan::from(" Reload directory content")) - .add_row() - .add_col(TextSpan::new("").bold().fg(key_color)) - .add_col(TextSpan::from(" Select file")) - .add_row() - .add_col(TextSpan::new("").bold().fg(key_color)) - .add_col(TextSpan::from(" Create new file")) - .add_row() - .add_col(TextSpan::new("").bold().fg(key_color)) + .add_col(TextSpan::new("").bold().fg(key_color)) .add_col(TextSpan::from( - " Open text file with preferred editor", + " Switch between explorer and log window", )) .add_row() - .add_col(TextSpan::new("").bold().fg(key_color)) - .add_col(TextSpan::from(" Quit termscp")) + .add_col(TextSpan::new("").bold().fg(key_color)) + .add_col(TextSpan::from(" Toggle hidden files")) .add_row() - .add_col(TextSpan::new("").bold().fg(key_color)) - .add_col(TextSpan::from(" Rename file")) + .add_col(TextSpan::new("").bold().fg(key_color)) + .add_col(TextSpan::from(" Change file sorting mode")) + .add_row() + .add_col(TextSpan::new("").bold().fg(key_color)) + .add_col(TextSpan::from(" Copy")) + .add_row() + .add_col(TextSpan::new("").bold().fg(key_color)) + .add_col(TextSpan::from(" Make directory")) + .add_row() + .add_col(TextSpan::new("").bold().fg(key_color)) + .add_col(TextSpan::from(" Search files")) + .add_row() + .add_col(TextSpan::new("").bold().fg(key_color)) + .add_col(TextSpan::from(" Go to path")) + .add_row() + .add_col(TextSpan::new("").bold().fg(key_color)) + .add_col(TextSpan::from(" Show help")) + .add_row() + .add_col(TextSpan::new("").bold().fg(key_color)) + .add_col(TextSpan::from( + " Show info about selected file", + )) + .add_row() + .add_col(TextSpan::new("").bold().fg(key_color)) + .add_col(TextSpan::from(" Reload directory content")) + .add_row() + .add_col(TextSpan::new("").bold().fg(key_color)) + .add_col(TextSpan::from(" Select file")) + .add_row() + .add_col(TextSpan::new("").bold().fg(key_color)) + .add_col(TextSpan::from(" Create new file")) + .add_row() + .add_col(TextSpan::new("").bold().fg(key_color)) + .add_col(TextSpan::from( + " Open text file with preferred editor", + )) + .add_row() + .add_col(TextSpan::new("").bold().fg(key_color)) + .add_col(TextSpan::from(" Quit termscp")) + .add_row() + .add_col(TextSpan::new("").bold().fg(key_color)) + .add_col(TextSpan::from(" Rename file")) .add_row() .add_col(TextSpan::new("").bold().fg(key_color)) - .add_col(TextSpan::from(" Save file as")) + .add_col(TextSpan::from(" Save file as")) .add_row() .add_col(TextSpan::new("").bold().fg(key_color)) - .add_col(TextSpan::from(" Go to parent directory")) + .add_col(TextSpan::from(" Go to parent directory")) .add_row() - .add_col(TextSpan::new("").bold().fg(key_color)) + .add_col(TextSpan::new("").bold().fg(key_color)) .add_col(TextSpan::from( - " Open file with default application for file type", + " Open file with default application for file type", )) .add_row() .add_col(TextSpan::new("").bold().fg(key_color)) .add_col(TextSpan::from( - " Open file with specified application", + " Open file with specified application", )) .add_row() .add_col(TextSpan::new("").bold().fg(key_color)) - .add_col(TextSpan::from(" Execute shell command")) + .add_col(TextSpan::from(" Execute shell command")) .add_row() .add_col(TextSpan::new("").bold().fg(key_color)) - .add_col(TextSpan::from(" Toggle synchronized browsing")) + .add_col(TextSpan::from( + " Toggle synchronized browsing", + )) .add_row() - .add_col(TextSpan::new("").bold().fg(key_color)) - .add_col(TextSpan::from(" Delete selected file")) + .add_col(TextSpan::new("").bold().fg(key_color)) + .add_col(TextSpan::from(" Delete selected file")) .add_row() .add_col(TextSpan::new("").bold().fg(key_color)) - .add_col(TextSpan::from(" Select all files")) + .add_col(TextSpan::from(" Select all files")) .add_row() .add_col(TextSpan::new("").bold().fg(key_color)) - .add_col(TextSpan::from(" Interrupt file transfer")) + .add_col(TextSpan::from(" Interrupt file transfer")) .build(), ), } diff --git a/src/ui/activities/filetransfer/components/transfer/mod.rs b/src/ui/activities/filetransfer/components/transfer/mod.rs index 26a6ff0..cfbf5ab 100644 --- a/src/ui/activities/filetransfer/components/transfer/mod.rs +++ b/src/ui/activities/filetransfer/components/transfer/mod.rs @@ -105,14 +105,14 @@ impl Component for ExplorerFind { Some(Msg::None) } // -- comp msg - Event::Keyboard(KeyEvent { code: Key::Tab, .. }) => { - Some(Msg::Ui(UiMsg::ExplorerTabbed)) - } + Event::Keyboard(KeyEvent { + code: Key::BackTab, .. + }) => Some(Msg::Ui(UiMsg::ExplorerBackTabbed)), Event::Keyboard(KeyEvent { code: Key::Esc, .. }) => { Some(Msg::Ui(UiMsg::CloseFindExplorer)) } Event::Keyboard(KeyEvent { - code: Key::Left | Key::Right, + code: Key::Left | Key::Right | Key::Tab, .. }) => Some(Msg::Ui(UiMsg::ChangeTransferWindow)), Event::Keyboard(KeyEvent { @@ -135,7 +135,7 @@ impl Component for ExplorerFind { modifiers: KeyModifiers::NONE, }) => Some(Msg::Ui(UiMsg::ShowFileSortingPopup)), Event::Keyboard(KeyEvent { - code: Key::Char('e') | Key::Delete, + code: Key::Char('e') | Key::Delete | Key::Function(8), modifiers: KeyModifiers::NONE, }) => Some(Msg::Ui(UiMsg::ShowDeletePopup)), Event::Keyboard(KeyEvent { @@ -147,7 +147,7 @@ impl Component for ExplorerFind { modifiers: KeyModifiers::NONE, }) => Some(Msg::Ui(UiMsg::ShowSaveAsPopup)), Event::Keyboard(KeyEvent { - code: Key::Char('v'), + code: Key::Char('v') | Key::Function(3), modifiers: KeyModifiers::NONE, }) => Some(Msg::Transfer(TransferMsg::OpenFile)), Event::Keyboard(KeyEvent { @@ -229,14 +229,15 @@ impl Component for ExplorerLocal { Some(Msg::None) } // -- comp msg - Event::Keyboard(KeyEvent { code: Key::Tab, .. }) => { - Some(Msg::Ui(UiMsg::ExplorerTabbed)) - } + Event::Keyboard(KeyEvent { + code: Key::BackTab, .. + }) => Some(Msg::Ui(UiMsg::ExplorerBackTabbed)), Event::Keyboard(KeyEvent { code: Key::Esc, .. }) => { Some(Msg::Ui(UiMsg::ShowDisconnectPopup)) } Event::Keyboard(KeyEvent { - code: Key::Right, .. + code: Key::Right | Key::Tab, + .. }) => Some(Msg::Ui(UiMsg::ChangeTransferWindow)), Event::Keyboard(KeyEvent { code: Key::Backspace, @@ -258,15 +259,15 @@ impl Component for ExplorerLocal { modifiers: KeyModifiers::NONE, }) => Some(Msg::Ui(UiMsg::ShowFileSortingPopup)), Event::Keyboard(KeyEvent { - code: Key::Char('c'), + code: Key::Char('c') | Key::Function(5), modifiers: KeyModifiers::NONE, }) => Some(Msg::Ui(UiMsg::ShowCopyPopup)), Event::Keyboard(KeyEvent { - code: Key::Char('d'), + code: Key::Char('d') | Key::Function(7), modifiers: KeyModifiers::NONE, }) => Some(Msg::Ui(UiMsg::ShowMkdirPopup)), Event::Keyboard(KeyEvent { - code: Key::Char('e') | Key::Delete, + code: Key::Char('e') | Key::Delete | Key::Function(8), modifiers: KeyModifiers::NONE, }) => Some(Msg::Ui(UiMsg::ShowDeletePopup)), Event::Keyboard(KeyEvent { @@ -290,11 +291,11 @@ impl Component for ExplorerLocal { modifiers: KeyModifiers::NONE, }) => Some(Msg::Ui(UiMsg::ShowNewFilePopup)), Event::Keyboard(KeyEvent { - code: Key::Char('o'), + code: Key::Char('o') | Key::Function(4), modifiers: KeyModifiers::NONE, }) => Some(Msg::Transfer(TransferMsg::OpenTextFile)), Event::Keyboard(KeyEvent { - code: Key::Char('r'), + code: Key::Char('r') | Key::Function(6), modifiers: KeyModifiers::NONE, }) => Some(Msg::Ui(UiMsg::ShowRenamePopup)), Event::Keyboard(KeyEvent { @@ -314,7 +315,7 @@ impl Component for ExplorerLocal { modifiers: KeyModifiers::NONE, }) => Some(Msg::Ui(UiMsg::ToggleSyncBrowsing)), Event::Keyboard(KeyEvent { - code: Key::Char('v'), + code: Key::Char('v') | Key::Function(3), modifiers: KeyModifiers::NONE, }) => Some(Msg::Transfer(TransferMsg::OpenFile)), Event::Keyboard(KeyEvent { @@ -396,14 +397,15 @@ impl Component for ExplorerRemote { Some(Msg::None) } // -- comp msg - Event::Keyboard(KeyEvent { code: Key::Tab, .. }) => { - Some(Msg::Ui(UiMsg::ExplorerTabbed)) - } + Event::Keyboard(KeyEvent { + code: Key::BackTab, .. + }) => Some(Msg::Ui(UiMsg::ExplorerBackTabbed)), Event::Keyboard(KeyEvent { code: Key::Esc, .. }) => { Some(Msg::Ui(UiMsg::ShowDisconnectPopup)) } Event::Keyboard(KeyEvent { - code: Key::Left, .. + code: Key::Left | Key::Tab, + .. }) => Some(Msg::Ui(UiMsg::ChangeTransferWindow)), Event::Keyboard(KeyEvent { code: Key::Backspace, @@ -425,15 +427,15 @@ impl Component for ExplorerRemote { modifiers: KeyModifiers::NONE, }) => Some(Msg::Ui(UiMsg::ShowFileSortingPopup)), Event::Keyboard(KeyEvent { - code: Key::Char('c'), + code: Key::Char('c') | Key::Function(5), modifiers: KeyModifiers::NONE, }) => Some(Msg::Ui(UiMsg::ShowCopyPopup)), Event::Keyboard(KeyEvent { - code: Key::Char('d'), + code: Key::Char('d') | Key::Function(7), modifiers: KeyModifiers::NONE, }) => Some(Msg::Ui(UiMsg::ShowMkdirPopup)), Event::Keyboard(KeyEvent { - code: Key::Char('e') | Key::Delete, + code: Key::Char('e') | Key::Delete | Key::Function(8), modifiers: KeyModifiers::NONE, }) => Some(Msg::Ui(UiMsg::ShowDeletePopup)), Event::Keyboard(KeyEvent { @@ -457,11 +459,11 @@ impl Component for ExplorerRemote { modifiers: KeyModifiers::NONE, }) => Some(Msg::Ui(UiMsg::ShowNewFilePopup)), Event::Keyboard(KeyEvent { - code: Key::Char('o'), + code: Key::Char('o') | Key::Function(4), modifiers: KeyModifiers::NONE, }) => Some(Msg::Transfer(TransferMsg::OpenTextFile)), Event::Keyboard(KeyEvent { - code: Key::Char('r'), + code: Key::Char('r') | Key::Function(6), modifiers: KeyModifiers::NONE, }) => Some(Msg::Ui(UiMsg::ShowRenamePopup)), Event::Keyboard(KeyEvent { @@ -481,7 +483,7 @@ impl Component for ExplorerRemote { modifiers: KeyModifiers::NONE, }) => Some(Msg::Ui(UiMsg::ToggleSyncBrowsing)), Event::Keyboard(KeyEvent { - code: Key::Char('v'), + code: Key::Char('v') | Key::Function(3), modifiers: KeyModifiers::NONE, }) => Some(Msg::Transfer(TransferMsg::OpenFile)), Event::Keyboard(KeyEvent { diff --git a/src/ui/activities/filetransfer/mod.rs b/src/ui/activities/filetransfer/mod.rs index 7f526ca..543a9c4 100644 --- a/src/ui/activities/filetransfer/mod.rs +++ b/src/ui/activities/filetransfer/mod.rs @@ -74,6 +74,7 @@ enum Id { FatalPopup, FileInfoPopup, FindPopup, + FooterBar, GlobalListener, GotoPopup, KeybindingsPopup, @@ -148,8 +149,8 @@ enum UiMsg { CloseRenamePopup, CloseSaveAsPopup, Disconnect, - ExplorerTabbed, - LogTabbed, + ExplorerBackTabbed, + LogBackTabbed, Quit, ReplacePopupTabbed, ShowCopyPopup, diff --git a/src/ui/activities/filetransfer/update.rs b/src/ui/activities/filetransfer/update.rs index 75c8c09..e60108c 100644 --- a/src/ui/activities/filetransfer/update.rs +++ b/src/ui/activities/filetransfer/update.rs @@ -417,10 +417,10 @@ impl FileTransferActivity { self.disconnect(); self.umount_disconnect(); } - UiMsg::ExplorerTabbed => { + UiMsg::ExplorerBackTabbed => { assert!(self.app.active(&Id::Log).is_ok()); } - UiMsg::LogTabbed => { + UiMsg::LogBackTabbed => { assert!(self.app.active(&Id::ExplorerLocal).is_ok()); } UiMsg::Quit => { diff --git a/src/ui/activities/filetransfer/view.rs b/src/ui/activities/filetransfer/view.rs index d301975..0ae02b2 100644 --- a/src/ui/activities/filetransfer/view.rs +++ b/src/ui/activities/filetransfer/view.rs @@ -52,8 +52,17 @@ impl FileTransferActivity { let remote_explorer_background = self.theme().transfer_remote_explorer_background; let remote_explorer_foreground = self.theme().transfer_remote_explorer_foreground; let remote_explorer_highlighted = self.theme().transfer_remote_explorer_highlighted; + let key_color = self.theme().misc_keys; let log_panel = self.theme().transfer_log_window; let log_background = self.theme().transfer_log_background; + assert!(self + .app + .mount( + Id::FooterBar, + Box::new(components::FooterBar::new(key_color)), + vec![] + ) + .is_ok()); assert!(self .app .mount( @@ -111,9 +120,19 @@ impl FileTransferActivity { let store: &mut Store = &mut context.store; let _ = context.terminal.raw_mut().draw(|f| { // Prepare chunks - let chunks = Layout::default() + let body = Layout::default() + .direction(Direction::Vertical) + .constraints( + [ + Constraint::Min(7), // Body + Constraint::Length(1), // Footer + ] + .as_ref(), + ) + .split(f.size()); + // main chunks + let main_chunks = Layout::default() .direction(Direction::Vertical) - .margin(1) .constraints( [ Constraint::Percentage(70), // Explorer @@ -121,17 +140,17 @@ impl FileTransferActivity { ] .as_ref(), ) - .split(f.size()); + .split(body[0]); // Create explorer chunks let tabs_chunks = Layout::default() .constraints([Constraint::Percentage(50), Constraint::Percentage(50)].as_ref()) .direction(Direction::Horizontal) - .split(chunks[0]); + .split(main_chunks[0]); // Create log box chunks let bottom_chunks = Layout::default() .constraints([Constraint::Length(1), Constraint::Length(10)].as_ref()) .direction(Direction::Vertical) - .split(chunks[1]); + .split(main_chunks[1]); // Create status bar chunks let status_bar_chunks = Layout::default() .constraints([Constraint::Percentage(50), Constraint::Percentage(50)].as_ref()) @@ -142,6 +161,8 @@ impl FileTransferActivity { if !store.isset(super::STORAGE_EXPLORER_WIDTH) { store.set_unsigned(super::STORAGE_EXPLORER_WIDTH, tabs_chunks[0].width as usize); } + // Draw footer + self.app.view(&Id::FooterBar, f, body[1]); // Draw explorers // @! Local explorer (Find or default) if matches!(self.browser.found_tab(), Some(FoundExplorerTab::Local)) { @@ -816,6 +837,20 @@ impl FileTransferActivity { }), Self::no_popup_mounted_clause(), ), + Sub::new( + SubEventClause::Keyboard(KeyEvent { + code: Key::Function(1), + modifiers: KeyModifiers::NONE, + }), + Self::no_popup_mounted_clause(), + ), + Sub::new( + SubEventClause::Keyboard(KeyEvent { + code: Key::Function(10), + modifiers: KeyModifiers::NONE, + }), + Self::no_popup_mounted_clause(), + ), Sub::new( SubEventClause::Keyboard(KeyEvent { code: Key::Char('q'), diff --git a/src/ui/activities/setup/components/commons.rs b/src/ui/activities/setup/components/commons.rs index 3344f92..bd62000 100644 --- a/src/ui/activities/setup/components/commons.rs +++ b/src/ui/activities/setup/components/commons.rs @@ -108,7 +108,7 @@ impl Header { .color(Color::Yellow) .sides(BorderSides::BOTTOM), ) - .choices(&["User interface", "SSH Keys", "Theme"]) + .choices(&["Configuration parameters", "SSH Keys", "Theme"]) .foreground(Color::Yellow) .value(match layout { ViewLayout::SetupForm => 0,