mirror of https://github.com/helix-editor/helix
Fix command line completion replacement for quoted items
With a directory with spaces in the name (for example `mkdir -p 'Temp/Abc Def'`), completing `Temp/Ab` would create a completion item `'Temp/AbAbc Def'`. Now it correctly completes `'Temp/Abc Def'`pull/13660/head
parent
8961ae1dc6
commit
67f1fe20c3
|
@ -3867,10 +3867,12 @@ fn quote_completion<'a>(
|
||||||
span.content = Cow::Owned(format!(
|
span.content = Cow::Owned(format!(
|
||||||
"'{}{}'",
|
"'{}{}'",
|
||||||
// Escape any inner single quotes by doubling them.
|
// Escape any inner single quotes by doubling them.
|
||||||
replace(token.content.as_ref().into(), '\'', "''"),
|
replace(token.content[..range.start].into(), '\'', "''"),
|
||||||
replace(span.content, '\'', "''")
|
replace(span.content, '\'', "''")
|
||||||
));
|
));
|
||||||
// Ignore `range.start` here since we're replacing the entire token.
|
// Ignore `range.start` here since we're replacing the entire token. We used
|
||||||
|
// `range.start` above to emulate the replacement that using `range.start` would have
|
||||||
|
// done.
|
||||||
((offset + token.content_start).., span)
|
((offset + token.content_start).., span)
|
||||||
}
|
}
|
||||||
TokenKind::Quoted(quote) => {
|
TokenKind::Quoted(quote) => {
|
||||||
|
|
Loading…
Reference in New Issue