zsh-workers
 help / color / mirror / code / Atom feed
* RE: PATCH: _list completer
@ 1999-03-24 11:42 Sven Wischnowsky
  1999-03-27 21:44 ` Meaning of $BUFFER (was Re: PATCH: _list completer) Bart Schaefer
  0 siblings, 1 reply; 2+ messages in thread
From: Sven Wischnowsky @ 1999-03-24 11:42 UTC (permalink / raw)
  To: zsh-workers


Andrej Borsenkow wrote:

>  And while I'm at it: how about a parameter giving the
> > contents of the whole buffer, e.g. as an array containing the lines?
> > (Both of these readonly, I think, at least for now.) Obviously the
> > best name for this would be `buffer', if only `BUFFER' weren't taken
> > (and this is a misnomer, anyway, considering the names of the builtin
> > zle widgets -- and an ugly one, I think).
> 
> But completion widget is a ZLE widget in the first place? And every
> user-defined ZLE widget has some special parameters automatically setup -
> and that includes BUFFER that does exactly what you need. See ZLE manuals.
> (And we could HISTNO to these, 'course).

Err...  `BUFFER' only gives the current line, not the whole multi-line 
buffer. And the builtin zle widgets that work only on the current line 
have a `line' in their name, while those working on the whole
multi-line buffer have a `buffer' in their name. It is this that I
find wrong with the name `BUFFER'. I agree that in many cases the line
that you get by `$BUFFER' is the most interesting thing to have, but
not always (just think about the discussion we had about reporting the
quotation character to completion widgets).

> Do you call completion widgets in special way? Is it possible to unify
> both - "normal" ZLE user-defined widgets and completion ones?

They are already (almost) the same with respect to the zle
parameters. It's just that completion widgets get them readonly, and
that is something I will not change, because the later phases of the
completion code have to position the cursor, remove the old word, and
insert the new <whatever>. If at that time the user would have changed 
the line or the cursor position things could go haywire.

Bye
 Sven


--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Meaning of $BUFFER (was Re: PATCH: _list completer)
  1999-03-24 11:42 PATCH: _list completer Sven Wischnowsky
@ 1999-03-27 21:44 ` Bart Schaefer
  0 siblings, 0 replies; 2+ messages in thread
From: Bart Schaefer @ 1999-03-27 21:44 UTC (permalink / raw)
  To: zsh-workers

On Mar 24, 12:42pm, Sven Wischnowsky wrote:
} Subject: RE: PATCH: _list completer
}
} 
} Andrej Borsenkow wrote:
} 
} > But completion widget is a ZLE widget in the first place? And every
} > user-defined ZLE widget has some special parameters automatically setup -
} > and that includes BUFFER that does exactly what you need.
} 
} Err...  `BUFFER' only gives the current line, not the whole multi-line 
} buffer.

Not entirely true.  $BUFFER gives the whole multi-line buffer if you're
in a true multi-line edit, e.g. after backing up in the history to a
multi-line entry or after executing push-line-or-edit.

What we don't currently have is a way to get at all lines as far back
as the PS1 prompt when you're at a PS2 or more deeply nested prompt.

I would have expected this to work:

	function get_BUFFER {
	  zle push-input
	  zle get-line
	  echo $BUFFER
	}
	zle -N get-BUFFER get_BUFFER

But the whole function aborts after the `zle push-input` and never gets
as far as the `zle get-line`.  There appears to be a whole lot of work
left to make sure that widgets calling other widgets behaves sanely.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1999-03-27 21:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-03-24 11:42 PATCH: _list completer Sven Wischnowsky
1999-03-27 21:44 ` Meaning of $BUFFER (was Re: PATCH: _list completer) Bart Schaefer

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).