Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: widget special PREFIX variable and cursor position with complete_in_word
- X-seq: zsh-users 18442
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: widget special PREFIX variable and cursor position with complete_in_word
- Date: Thu, 13 Feb 2014 09:25:30 -0800
- In-reply-to: <ldii13$jg7$1@ger.gmane.org>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <ldgnl5$fo8$1@ger.gmane.org> <140212214707.ZM25929@torch.brasslantern.com> <ldii13$jg7$1@ger.gmane.org>
On Feb 13, 2:38pm, Yuri D'Elia wrote:
} Subject: Re: widget special PREFIX variable and cursor position with compl
}
} I'm still refining the ability to highlight the first ambiguous
} character in a completion list
Ah, thank you, that context is helpful.
} > The first time you press TAB, if the result is ambiguous (in your
} > example, four possible results) a completion listing and the cursor
} > is moved to the first disambiguating location. At this point you
}
} Yes, at this point I'm shown the completion list for the first
} ambiguous position, and I need to know the string up to the cursor
} location (not the entire argument), in order to match the ambiguous
} character in the list.
You want $compstate[unambiguous] and $compstate[unambiguous_cursor],
but you can't examine them until after the rest of completion is done
with its work -- perhaps by poking something into the $comppostfuncs
array (see the _all_matches completer for an example).
The string slice
${${compstate[unambiguous]}[1,${compstate[unambiguous_cursor]}]}
should be the common prefix of all the entries in the listing but NOT
including any common characters that are SHOWN in the listing. If you
want more details, ${(s/:/)compstate[unambiguous_positions]} gives
the offsets into $compstate[unambiguous] that divide it into segments
that would be kept unchanged when updating the command line.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author