Experiment with OSC 7

Ref: https://github.com/wez/wezterm/issues/2054
pull/485/head
Arijit Basu 2 years ago committed by Arijit Basu
parent 07b2374616
commit 3c8f6e1b08

11
Cargo.lock generated

@ -308,6 +308,16 @@ dependencies = [
"serde",
]
[[package]]
name = "gethostname"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c1ebd34e35c46e00bb73e81363248d627782724609fe1b6396f553f68fe3862e"
dependencies = [
"libc",
"winapi",
]
[[package]]
name = "getrandom"
version = "0.2.6"
@ -1155,6 +1165,7 @@ dependencies = [
"criterion",
"crossterm",
"dirs",
"gethostname",
"humansize",
"indexmap",
"lazy_static",

@ -31,6 +31,7 @@ crossterm = "0.23.2"
dirs = "4.0.0"
ansi-to-tui-forked = "0.5.2-fix.offset"
regex = "1.5.6"
gethostname = "0.2.3"
[dependencies.lazy_static]
version = "1.4.0"

@ -20,6 +20,7 @@ pub use crate::pipe::Pipe;
use crate::ui::Layout;
use anyhow::{bail, Result};
use chrono::{DateTime, Local};
use gethostname::gethostname;
use indexmap::set::IndexSet;
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
@ -177,6 +178,7 @@ pub struct App {
pub logs_hidden: bool,
pub history: History,
pub last_modes: Vec<Mode>,
pub hostname: String,
}
impl App {
@ -288,6 +290,8 @@ impl App {
prompt: config.general.prompt.format.clone().unwrap_or_default(),
};
let hostname = gethostname().to_string_lossy().to_string();
let mut app = Self {
version: VERSION.to_string(),
config,
@ -307,6 +311,7 @@ impl App {
logs_hidden: Default::default(),
history: Default::default(),
last_modes: Default::default(),
hostname,
};
let has_errs = !load_errs.is_empty();
@ -753,6 +758,7 @@ impl App {
if save_history {
self.history = self.history.push(format!("{}/", self.pwd));
}
print!("\x1b]7;file://{}{};\x1b\\", &self.hostname, &self.pwd);
self.explore_pwd()
}
Err(e) => self.log_error(e.to_string()),

Loading…
Cancel
Save