From 8254c9c071bff087c3d52a5ac2811b5b7fc367ce Mon Sep 17 00:00:00 2001 From: "Barton E. Schaefer" Date: Sat, 21 Mar 2015 09:29:52 -0700 Subject: users/20034: adjust PREFIX and SUFFIX for unambiguous_cursor on second completion attempt with GLOB_COMPLETE --- ChangeLog | 6 ++++++ Completion/Base/Core/_main_complete | 10 ++++++++++ 2 files changed, 16 insertions(+) diff --git a/ChangeLog b/ChangeLog index af0d54b2e..bc7ac80d3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2015-03-21 Barton E. Schaefer + + * users/20034: Completion/Base/Core/_main_complete: adjust + PREFIX and SUFFIX for unambiguous_cursor on second completion + attempt with GLOB_COMPLETE + 2015-03-20 Peter Stephenson * 34753 / 34754: Test/C02cond.ztst: work around lack diff --git a/Completion/Base/Core/_main_complete b/Completion/Base/Core/_main_complete index d6a100777..977ab49ee 100644 --- a/Completion/Base/Core/_main_complete +++ b/Completion/Base/Core/_main_complete @@ -68,6 +68,16 @@ if [[ "$compstate[insert]" = tab* ]]; then compstate[insert]="${compstate[insert]//tab /}" fi +# Second attempt at GLOB_COMPLETE + +if [[ "$compstate[pattern_match]" = "*" && + "$_lastcomp[unambiguous]" = "$PREFIX" && + -n "$_lastcomp[unambiguous_cursor]" ]]; then + integer upos="$_lastcomp[unambiguous_cursor]" + SUFFIX="$PREFIX[upos,-1]$SUFFIX" + PREFIX="$PREFIX[1,upos-1]" +fi + # Special completion contexts after `~' and `='. if [[ -z "$compstate[quote]" ]]; then -- cgit 1.4.1