zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-workers@sunsite.dk
Subject: Re: crash when expand-or-complete widget wrapped
Date: Sun, 12 Apr 2009 10:55:40 -0700	[thread overview]
Message-ID: <090412105540.ZM20038@torch.brasslantern.com> (raw)
In-Reply-To: <20090411043152.GA26742@datura.dylex.net>

On Apr 11, 12:31am, Dylan Alex Simon wrote:
} Subject: Re: crash when expand-or-complete widget wrapped
}
} > > Is there some reason this is not an okay thing to do or that
} > > completion widgets should be called differently? (I'm working on
} > > improving predict-on.)
} >
} > You can't call completion widgets from non-completion widgets, in the
} > general case.  In fact you generally can't call completion widgets
} > with "zle widget_name", because completion widgets don't share the
} > normal editor state.
} 
} > zle -C widget-wrapper expand-or-complete widget-wrapper
} 
} Sorry, I guess my question was a little confused (I shouldn't have
} said "completion widgets"). As far as I understand, expand-or-complete
} and complete-word are not themselves actual completion widgets (they
} aren't generating completion lists) but rather zle widgets that invoke
} completion.

No, you spoke correctly: "completion widgets" are zle widgets (either
built-in or user-defined) to invoke completion; "completion functions"
are shell functions intended to be bound to completion widgets with
"zle -C"; and "completers" are shell functions that generate matches
for use by completion functions.  However, those terms are not always
used with very much precision.  Also, "completion system" refers to
the entire set of completers and completion functions as installed by
"compinit" (and thereby turned into completion widgets).

What's confused is my memory.  It should be OK to invoke a completion
widget from a normal widget; what doesn't work is invoking a normal
widget from a completion function (or from a completer).

} The problem seems only to happen when you invoke the dotted version
} "zle .expand-or-complete" rather than "zle expand-and-complete".

I'm unable to reproduce the crash, but I believe I know at least part
of what's going on here.

"compinit" replaces the built-in complete-word, expand-or-complete,
etc., widgets with the completion function bindings that call through
to _main_complete to invoke the completion system.

However, one of the basic rules of zle widgets is that the dotted
versions are immutable, so compinit can't replace those.  When you
define your widget-wrapper to invoke "zle .$WIDGET", you're calling
directly through to the built-in widgets, bypassing the completion
system entirely and calling into the old compctl system.

Those "old" widgets nevertheless share some guts with the builtins
that form the core of the "new" completion system, and I suspect that
there's an unexpected conflict caused by insert-and-predict playing
with BUFFER and/or CURSOR and/or the values in the compstate hash.


      reply	other threads:[~2009-04-12 17:56 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-07  3:57 subscript too small after complete in variable Dylan Alex Simon
2009-04-07  4:16 ` Bart Schaefer
2009-04-07  9:18   ` Peter Stephenson
2009-04-08  4:49 ` crash when expand-or-complete widget wrapped Dylan Alex Simon
2009-04-08 16:02   ` Bart Schaefer
2009-04-11  4:31   ` Dylan Alex Simon
2009-04-12 17:55     ` Bart Schaefer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=090412105540.ZM20038@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).