mirror of
https://github.com/veeso/termscp.git
synced 2025-12-07 09:36:00 -08:00
Removed storage key for filetransfer terminal width
This commit is contained in:
committed by
Christian Visintin
parent
e047179ea0
commit
b8efe6985f
@@ -214,11 +214,13 @@ impl FileTransferActivity {
|
|||||||
/// Update local file list
|
/// Update local file list
|
||||||
pub(super) fn update_local_filelist(&mut self) {
|
pub(super) fn update_local_filelist(&mut self) {
|
||||||
// Get width
|
// Get width
|
||||||
let width: usize = self
|
let width = self
|
||||||
.context()
|
.context_mut()
|
||||||
.store()
|
.terminal()
|
||||||
.get_unsigned(super::STORAGE_EXPLORER_WIDTH)
|
.raw()
|
||||||
.unwrap_or(256);
|
.size()
|
||||||
|
.map(|x| (x.width / 2) - 2)
|
||||||
|
.unwrap_or(0) as usize;
|
||||||
let hostname: String = match hostname::get() {
|
let hostname: String = match hostname::get() {
|
||||||
Ok(h) => {
|
Ok(h) => {
|
||||||
let hostname: String = h.as_os_str().to_string_lossy().to_string();
|
let hostname: String = h.as_os_str().to_string_lossy().to_string();
|
||||||
@@ -258,11 +260,13 @@ impl FileTransferActivity {
|
|||||||
|
|
||||||
/// Update remote file list
|
/// Update remote file list
|
||||||
pub(super) fn update_remote_filelist(&mut self) {
|
pub(super) fn update_remote_filelist(&mut self) {
|
||||||
let width: usize = self
|
let width = self
|
||||||
.context()
|
.context_mut()
|
||||||
.store()
|
.terminal()
|
||||||
.get_unsigned(super::STORAGE_EXPLORER_WIDTH)
|
.raw()
|
||||||
.unwrap_or(256);
|
.size()
|
||||||
|
.map(|x| (x.width / 2) - 2)
|
||||||
|
.unwrap_or(0) as usize;
|
||||||
let hostname = self.get_remote_hostname();
|
let hostname = self.get_remote_hostname();
|
||||||
let hostname: String = format!(
|
let hostname: String = format!(
|
||||||
"{}:{} ",
|
"{}:{} ",
|
||||||
|
|||||||
@@ -54,11 +54,6 @@ use std::time::Duration;
|
|||||||
use tempfile::TempDir;
|
use tempfile::TempDir;
|
||||||
use tuirealm::{Application, EventListenerCfg, NoUserEvent};
|
use tuirealm::{Application, EventListenerCfg, NoUserEvent};
|
||||||
|
|
||||||
// -- Storage keys
|
|
||||||
|
|
||||||
/// Stores the explorer width
|
|
||||||
const STORAGE_EXPLORER_WIDTH: &str = "FT_EW";
|
|
||||||
|
|
||||||
// -- components
|
// -- components
|
||||||
|
|
||||||
#[derive(Debug, Eq, PartialEq, Clone, Hash)]
|
#[derive(Debug, Eq, PartialEq, Clone, Hash)]
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ use super::{
|
|||||||
components, Context, FileTransferActivity, Id,
|
components, Context, FileTransferActivity, Id,
|
||||||
};
|
};
|
||||||
use crate::explorer::FileSorting;
|
use crate::explorer::FileSorting;
|
||||||
use crate::ui::store::Store;
|
|
||||||
use crate::utils::ui::draw_area_in;
|
use crate::utils::ui::draw_area_in;
|
||||||
// Ext
|
// Ext
|
||||||
use remotefs::fs::Entry;
|
use remotefs::fs::Entry;
|
||||||
@@ -117,7 +116,6 @@ impl FileTransferActivity {
|
|||||||
pub(super) fn view(&mut self) {
|
pub(super) fn view(&mut self) {
|
||||||
self.redraw = false;
|
self.redraw = false;
|
||||||
let mut context: Context = self.context.take().unwrap();
|
let mut context: Context = self.context.take().unwrap();
|
||||||
let store: &mut Store = &mut context.store;
|
|
||||||
let _ = context.terminal.raw_mut().draw(|f| {
|
let _ = context.terminal.raw_mut().draw(|f| {
|
||||||
// Prepare chunks
|
// Prepare chunks
|
||||||
let body = Layout::default()
|
let body = Layout::default()
|
||||||
@@ -157,10 +155,6 @@ impl FileTransferActivity {
|
|||||||
.direction(Direction::Horizontal)
|
.direction(Direction::Horizontal)
|
||||||
.horizontal_margin(1)
|
.horizontal_margin(1)
|
||||||
.split(bottom_chunks[0]);
|
.split(bottom_chunks[0]);
|
||||||
// If width is unset in the storage, set width
|
|
||||||
if !store.isset(super::STORAGE_EXPLORER_WIDTH) {
|
|
||||||
store.set_unsigned(super::STORAGE_EXPLORER_WIDTH, tabs_chunks[0].width as usize);
|
|
||||||
}
|
|
||||||
// Draw footer
|
// Draw footer
|
||||||
self.app.view(&Id::FooterBar, f, body[1]);
|
self.app.view(&Id::FooterBar, f, body[1]);
|
||||||
// Draw explorers
|
// Draw explorers
|
||||||
|
|||||||
Reference in New Issue
Block a user