zsh-workers
 help / color / mirror / code / Atom feed
* ZLE and compsys miscellaneous
@ 2004-08-22 22:37 Bart Schaefer
  2004-08-24  6:53 ` Wayne Davison
  0 siblings, 1 reply; 2+ messages in thread
From: Bart Schaefer @ 2004-08-22 22:37 UTC (permalink / raw)
  To: zsh-workers

I just noticed that down-line-or-history and up-line-or-history don't 
behave as I expected when given a negative NUMERIC.  They go up or down 
lines within the buffer as expected, but if there is no room to move in
the buffer they use the absolute value of NUMERIC for the history motion.

------

When you use #compdef -k or -K in a widget function file, the widget name 
used is always given an underscore prefix.  Remind me why?  This makes it 
a little confusing to set new styles for that widget context.  In any case 
that behavior should be documented.

------

I'd like to suggest a new #keyword introducer to be recognized by compinit
(or maybe it should just be a new option to #compdef, but I'll write about
it as a new keyword here).  The keyword is "generic", which means that the
function defined in the file is a completer for use with the _generic 
widget function.

For example, the _insert_kept function I posted in the "tip of the day"
thread could be a file that looks like:

    #generic complete-word \C-xE
    (( $#kept )) || return 1
    local action
    zstyle -s :completion:$curcontext insert-kept action
    if [[ -n $action ]]
    then compstate[insert]=$action
    fi
    compadd -a kept

And the #generic line would cause compinit to autoload the function and 
execute:

    zle -C _insert_kept complete-word _generic
    zstyle ':completion:_insert_kept:*' completer _insert_kept
    bindkey '\C-xE' _insert_kept

I anticipate that Oliver is going to object to having a zstyle set like 
that, but if that's the only way _generic can be passed a completer, I 
don't see much choice in the matter.


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

* Re: ZLE and compsys miscellaneous
  2004-08-22 22:37 ZLE and compsys miscellaneous Bart Schaefer
@ 2004-08-24  6:53 ` Wayne Davison
  0 siblings, 0 replies; 2+ messages in thread
From: Wayne Davison @ 2004-08-24  6:53 UTC (permalink / raw)
  To: zsh-workers

[-- Attachment #1: Type: text/plain, Size: 580 bytes --]

On Sun, Aug 22, 2004 at 03:37:33PM -0700, Bart Schaefer wrote:
> I just noticed that down-line-or-history and up-line-or-history don't 
> behave as I expected when given a negative NUMERIC.  They go up or down 
> lines within the buffer as expected, but if there is no room to move in
> the buffer they use the absolute value of NUMERIC for the history motion.

Yeah.  This also looks like it affects the {down,up}-line-or-search
functions as well.  I think the upline()/downline() helper functions
in zle_hist.c need to negate the "n" value, as in the attached patch.

..wayne..

[-- Attachment #2: negate.patch --]
[-- Type: text/plain, Size: 391 bytes --]

--- Src/Zle/zle_hist.c	29 Jul 2004 14:22:22 -0000	1.14
+++ Src/Zle/zle_hist.c	24 Aug 2004 06:51:08 -0000
@@ -92,7 +92,7 @@ upline(void)
 
     if (n < 0) {
 	zmult = -zmult;
-	n = downline();
+	n = -downline();
 	zmult = -zmult;
 	return n;
     }
@@ -176,7 +176,7 @@ downline(void)
 
     if (n < 0) {
 	zmult = -zmult;
-	n = upline();
+	n = -upline();
 	zmult = -zmult;
 	return n;
     }

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

end of thread, other threads:[~2004-08-24  6:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-22 22:37 ZLE and compsys miscellaneous Bart Schaefer
2004-08-24  6:53 ` Wayne Davison

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