Skip to content

Commit 4656629

Browse files
authored
Use non-canonicalized paths in shell integrations (#14832)
This simply replaces uses of the deprecated function `current_dir_str` with `EngineState::cwd_as_string` in `run_shell_integration_*` functions. The main difference being that the latter does not canonicalize paths. Fixes #14619
1 parent 4e1b06c commit 4656629

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

crates/nu-cli/src/repl.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use miette::{ErrReport, IntoDiagnostic, Result};
1919
use nu_cmd_base::util::get_editor;
2020
use nu_color_config::StyleComputer;
2121
#[allow(deprecated)]
22-
use nu_engine::{current_dir_str, env_to_strings};
22+
use nu_engine::env_to_strings;
2323
use nu_parser::{lex, parse, trim_quotes_str};
2424
use nu_protocol::{
2525
config::NuCursorShape,
@@ -971,8 +971,7 @@ fn run_shell_integration_osc2(
971971
stack: &mut Stack,
972972
use_color: bool,
973973
) {
974-
#[allow(deprecated)]
975-
if let Ok(path) = current_dir_str(engine_state, stack) {
974+
if let Ok(path) = engine_state.cwd_as_string(Some(stack)) {
976975
let start_time = Instant::now();
977976

978977
// Try to abbreviate string for windows title
@@ -1016,8 +1015,7 @@ fn run_shell_integration_osc7(
10161015
stack: &mut Stack,
10171016
use_color: bool,
10181017
) {
1019-
#[allow(deprecated)]
1020-
if let Ok(path) = current_dir_str(engine_state, stack) {
1018+
if let Ok(path) = engine_state.cwd_as_string(Some(stack)) {
10211019
let start_time = Instant::now();
10221020

10231021
// Otherwise, communicate the path as OSC 7 (often used for spawning new tabs in the same dir)
@@ -1040,8 +1038,7 @@ fn run_shell_integration_osc7(
10401038
}
10411039

10421040
fn run_shell_integration_osc9_9(engine_state: &EngineState, stack: &mut Stack, use_color: bool) {
1043-
#[allow(deprecated)]
1044-
if let Ok(path) = current_dir_str(engine_state, stack) {
1041+
if let Ok(path) = engine_state.cwd_as_string(Some(stack)) {
10451042
let start_time = Instant::now();
10461043

10471044
// Otherwise, communicate the path as OSC 9;9 from ConEmu (often used for spawning new tabs in the same dir)
@@ -1065,8 +1062,7 @@ fn run_shell_integration_osc633(
10651062
use_color: bool,
10661063
repl_cmd_line_text: String,
10671064
) {
1068-
#[allow(deprecated)]
1069-
if let Ok(path) = current_dir_str(engine_state, stack) {
1065+
if let Ok(path) = engine_state.cwd_as_string(Some(stack)) {
10701066
// Supported escape sequences of Microsoft's Visual Studio Code (vscode)
10711067
// https://code.visualstudio.com/docs/terminal/shell-integration#_supported-escape-sequences
10721068
if stack

0 commit comments

Comments
 (0)