@@ -401,6 +401,7 @@ var __meta__ = {
401401            var  that  =  this , 
402402                key  =  that . _last , 
403403                value  =  that . _accessor ( ) , 
404+                 currentValue  =  that . value ( ) , 
404405                element  =  that . element [ 0 ] , 
405406                caretIdx  =  caret ( element ) [ 0 ] , 
406407                separator  =  that . _separator ( ) , 
@@ -429,8 +430,8 @@ var __meta__ = {
429430                caretIdx  =  ( accentFoldingFiltering  ? value . toLocaleLowerCase ( accentFoldingFiltering )  : value . toLowerCase ( ) ) . indexOf ( accentFoldingFiltering  ? word . toLocaleLowerCase ( accentFoldingFiltering )  : word . toLowerCase ( ) )  +  1 ; 
430431            } 
431432
432-             idx  =  value . substring ( 0 ,  caretIdx ) . lastIndexOf ( separator ) ; 
433-             idx  =  idx  >  - 1  ? caretIdx  -  ( idx  +  separator . length )  : caretIdx ; 
433+             idx  =  value . substring ( 0 ,  caretIdx ) . lastIndexOf ( that . _defaultSeparator ( ) ) ; 
434+             idx  =  idx  >  - 1  ? caretIdx  -  ( idx  +  that . _defaultSeparator ( ) . length )  : caretIdx ; 
434435            value  =  words [ wordIndex ] . substring ( 0 ,  idx ) ; 
435436
436437            if  ( word )  { 
@@ -452,7 +453,20 @@ var __meta__ = {
452453
453454            words [ wordIndex ]  =  value ; 
454455
455-             that . _accessor ( words . join ( separator  ||  "" ) ) ; 
456+             if  ( typeof  that . options . separator  ==  'object'  &&  that . options . separator  !=  null )  { 
457+                 if  ( currentValue . length  >  1 )  { 
458+                     let  lastSeparator  =  [ ...currentValue . matchAll ( separator . source ) ] . pop ( ) ; 
459+                     if  ( lastSeparator )  { 
460+                         that . _accessor ( words . slice ( 0 ,  - 1 ) . join ( that . _defaultSeparator ( )  ||  "" )  +  lastSeparator  +  words [ words . length  -  1 ] ) ; 
461+                     }  else  { 
462+                         that . _accessor ( words . slice ( 0 ,  - 1 ) . join ( that . _defaultSeparator ( )  ||  "" ) ) ; 
463+                     } 
464+                 }  else  { 
465+                   that . _accessor ( words . join ( this . _defaultSeparator ( )  ||  "" ) ) ; 
466+                 } 
467+             }  else  { 
468+                 that . _accessor ( words . join ( separator  ||  "" ) ) ; 
469+             } 
456470
457471            if  ( element  ===  activeElement ( ) )  { 
458472                caret ( element ,  caretIdx ,  selectionEnd ) ; 
@@ -752,7 +766,18 @@ var __meta__ = {
752766        _move : function ( action )  { 
753767            this . listView [ action ] ( ) ; 
754768
755-             if  ( this . options . suggest )  { 
769+             if  ( this . options . suggest  &&  this . listView . focus ( )  ==  null  &&  action  ==  "focusNext" )  { 
770+                 this . listView . focus ( 0 ) ; 
771+                 this . suggest ( this . listView . _view [ 0 ] . item ) ; 
772+             }  else  if  ( this . options . suggest  &&  this . listView . focus ( )  ==  null  &&  action  ==  "focusPrev" )  { 
773+                 let  index  =  this . listView . _view . length  -  1 ; 
774+                 this . listView . focus ( index ) ; 
775+                 this . suggest ( this . listView . _view [ index ] . item ) ; 
776+             }  else  if  ( this . options . suggest  &&  action  ==  "focusFirst" )  { 
777+                 caret ( this . element ) [ 0 ] ; 
778+             }  else  if  ( this . options . suggest  &&  action  ==  "focusLast" )  { 
779+                 caret ( this . element ) [ this . element . val ( ) . length  -  1 ] ; 
780+             }  else  if  ( this . options . suggest  &&  this . listView . focus ( )  !=  null )  { 
756781                this . suggest ( this . listView . focus ( ) ) ; 
757782            } 
758783        } , 
0 commit comments