mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-01-19 18:22:45 +08:00
Remove unescape_string_in_place
Only used in two places and did not do anything sensible
This commit is contained in:
parent
364c53c5e5
commit
ab0fdd1918
|
@ -1,7 +1,5 @@
|
|||
use super::prelude::*;
|
||||
use crate::common::{
|
||||
unescape_string, unescape_string_in_place, ScopeGuard, UnescapeFlags, UnescapeStringStyle,
|
||||
};
|
||||
use crate::common::{unescape_string, ScopeGuard, UnescapeFlags, UnescapeStringStyle};
|
||||
use crate::complete::{complete_add_wrapper, complete_remove_wrapper, CompletionRequestOptions};
|
||||
use crate::highlight::colorize;
|
||||
use crate::highlight::highlight_shell;
|
||||
|
@ -536,10 +534,11 @@ pub fn complete(parser: &Parser, streams: &mut IoStreams, argv: &mut [&wstr]) ->
|
|||
// The input data is meant to be something like you would have on the command
|
||||
// line, e.g. includes backslashes. The output should be raw, i.e. unescaped. So
|
||||
// we need to unescape the command line. See #1127.
|
||||
unescape_string_in_place(
|
||||
&mut faux_cmdline_with_completion,
|
||||
faux_cmdline_with_completion = unescape_string(
|
||||
&faux_cmdline_with_completion,
|
||||
UnescapeStringStyle::Script(UnescapeFlags::default()),
|
||||
);
|
||||
)
|
||||
.expect("Unescaping commandline to complete failed");
|
||||
}
|
||||
|
||||
// Append any description.
|
||||
|
|
|
@ -494,13 +494,6 @@ pub fn unescape_string(input: &wstr, style: UnescapeStringStyle) -> Option<WStri
|
|||
}
|
||||
}
|
||||
|
||||
// TODO Delete this.
|
||||
pub fn unescape_string_in_place(s: &mut WString, style: UnescapeStringStyle) -> bool {
|
||||
unescape_string(s, style)
|
||||
.map(|unescaped| *s = unescaped)
|
||||
.is_some()
|
||||
}
|
||||
|
||||
/// Returns the unescaped version of input, or None on error.
|
||||
fn unescape_string_internal(input: &wstr, flags: UnescapeFlags) -> Option<WString> {
|
||||
let mut result = WString::new();
|
||||
|
|
|
@ -7,7 +7,7 @@ use crate::ast::{
|
|||
use crate::builtins::shared::builtin_exists;
|
||||
use crate::color::RgbColor;
|
||||
use crate::common::{
|
||||
unescape_string_in_place, valid_var_name, valid_var_name_char, UnescapeFlags, ASCII_MAX,
|
||||
unescape_string, valid_var_name, valid_var_name_char, UnescapeFlags, ASCII_MAX,
|
||||
EXPAND_RESERVED_BASE, EXPAND_RESERVED_END,
|
||||
};
|
||||
use crate::env::Environment;
|
||||
|
@ -677,9 +677,8 @@ fn range_is_potential_path(
|
|||
// Get the node source, unescape it, and then pass it to is_potential_path along with the
|
||||
// working directory (as a one element list).
|
||||
let mut result = false;
|
||||
let mut token = (src[range.start()..range.end()]).to_owned();
|
||||
if unescape_string_in_place(
|
||||
&mut token,
|
||||
if let Some(mut token) = unescape_string(
|
||||
&src[range.start()..range.end()],
|
||||
crate::common::UnescapeStringStyle::Script(UnescapeFlags::SPECIAL),
|
||||
) {
|
||||
// Big hack: is_potential_path expects a tilde, but unescape_string gives us HOME_DIRECTORY.
|
||||
|
|
Loading…
Reference in New Issue
Block a user