@ -2847,13 +2847,10 @@ pub(super) fn command_mode(cx: &mut Context) {
} else {
} else {
// Otherwise, use the command's completer and the last shellword
// Otherwise, use the command's completer and the last shellword
// as completion input.
// as completion input.
let ( part, part _len) = if words . len ( ) = = 1 | | shellwords . ends_with_whitespace ( ) {
let ( word, word _len) = if words . len ( ) = = 1 | | shellwords . ends_with_whitespace ( ) {
( & Cow ::Borrowed ( "" ) , 0 )
( & Cow ::Borrowed ( "" ) , 0 )
} else {
} else {
(
( words . last ( ) . unwrap ( ) , words . last ( ) . unwrap ( ) . len ( ) )
words . last ( ) . unwrap ( ) ,
shellwords . parts ( ) . last ( ) . unwrap ( ) . len ( ) ,
)
} ;
} ;
let argument_number = argument_number_of ( & shellwords ) ;
let argument_number = argument_number_of ( & shellwords ) ;
@ -2862,13 +2859,13 @@ pub(super) fn command_mode(cx: &mut Context) {
. get ( & words [ 0 ] as & str )
. get ( & words [ 0 ] as & str )
. map ( | tc | tc . completer_for_argument_number ( argument_number ) )
. map ( | tc | tc . completer_for_argument_number ( argument_number ) )
{
{
completer ( editor , part )
completer ( editor , word )
. into_iter ( )
. into_iter ( )
. map ( | ( range , file ) | {
. map ( | ( range , file ) | {
let file = shellwords ::escape ( file ) ;
let file = shellwords ::escape ( file ) ;
// offset ranges to input
// offset ranges to input
let offset = input . len ( ) - part _len;
let offset = input . len ( ) - word _len;
let range = ( range . start + offset ) .. ;
let range = ( range . start + offset ) .. ;
( range , file )
( range , file )
} )
} )