The ZLE widget added in #13710 saves the current Tab binding and
delegates to it. If the plugin is sourced more than once, the saved
binding points to the widget itself, causing infinite recursion and
"maximum nested function level reached" errors on any Tab press.
Guard against self-reference by only capturing the binding on first
load and falling back to expand-or-complete if the saved value is
our own widget.
Fixes#13714
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This change references `$RANDOM` outside the subshell to refresh it for the
next subshell invocation. Otherwise, subsequent runs of the function get the
same value and, if run simultaneously, they may clobber each others' temp .z
files.
This is due to how zsh distributes RANDOM values when running inside a
subshell:
subshells that reference RANDOM will result in identical pseudo-random
values unless the value of RANDOM is referenced or seeded in the parent
shell in between subshell invocations
See: http://zsh.sourceforge.net/Doc/Release/Parameters.html#index-RANDOM
The old implementation would attempt to load both the default and custom
implementations, with the custom one coming first, so it would get clobbered
by the default version.