Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Problem with zle completion listing function.



I have the following function set up as an ordinary zle widget, with zle
-N, and bound to ^D.  It's supposed to make sure that when I type ^D I
always get a freshly calculated list, so that I can list the contents of a
directory which appears with menu completion --- otherwise it will just
redraw the current menu list.  (Of course, what I *really* want is
something smarter: if a list is already displayed, assume I want it updated
based on what's currently on the command line, but I couldn't work out how
to do that.)


# This is supposed to work like delete-char-or-list, except that the
# list generated is always new.

(( CURSOR = CURSOR ))

zle delete-char-or-list


It's a hack, but it still doesn't work.  First, I only get the new list the
second time I type ^D.  More explicitly: suppose I am in the top-level zsh
directory with menucomplete set, and type `echo Co<TAB>'.  This will show
`Completion/'; a further TAB would show `Config/'.  Now I type '^D'.  The
first time, I just get the same list, only the second time do I get the
contents I want.  I'm sure I should be able to work out what's going on,
but it's not immediately obvious.

The real problem is when I type '^D' a third time: the shell then crashes.
This is obviously a real bug.  Here's the backtrace.  `*minfo.cur' is
0xffffffff, which is obviously not a good thing to dereference.

#0  0xef4ec374 in callcompfunc (s=0x102ab0 "Config/", 
    fn=0x137f98 "_main_complete") at ../../../Src/Zle/compcore.c:745
#1  0xef4ecf28 in makecomplist (s=0x102ab0 "Config/", incmd=0, lst=1)
    at ../../../Src/Zle/compcore.c:924
#2  0xef4ea860 in do_completion (dummy=0xef572794, dat=0xefffe170)
    at ../../../Src/Zle/compcore.c:342
#3  0x818e4 in runhookdef (h=0xef572794, d=0xefffe170)
    at ../../Src/module.c:1858
#4  0xef54e834 in docompletion (s=0x1431d0 "Config/", lst=1, incmd=0)
    at ../../../Src/Zle/zle_tricky.c:1740
#5  0xef54a524 in docomplete (lst=1) at ../../../Src/Zle/zle_tricky.c:784
#6  0xef547e9c in deletecharorlist (args=0xef572710)
    at ../../../Src/Zle/zle_tricky.c:250
#7  0xef547ad4 in completecall (args=0xefffe56c)
    at ../../../Src/Zle/zle_tricky.c:176
#8  0xef5377dc in execzlefunc (func=0xef57045c, args=0xefffe56c)
    at ../../../Src/Zle/zle_main.c:659
#9  0xef5477d8 in bin_zle_call (name=0x1029a0 "zle", args=0xefffe56c, 
    ops=0xefffe5b8 "", func=0 '\000') at ../../../Src/Zle/zle_thingy.c:651
#10 0xef54651c in bin_zle (name=0x1029a0 "zle", args=0xefffe568, 
    ops=0xefffe5b8 "", func=0) at ../../../Src/Zle/zle_thingy.c:369
#11 0x1aa00 in execbuiltin (args=0x102980, bn=0xef57275c)
    at ../../Src/builtin.c:367
#12 0x3b368 in execcmd (state=0xefffe9f0, input=0, output=0, how=18, last1=2)
    at ../../Src/exec.c:2287
#13 0x363e0 in execpline2 (state=0xefffe9f0, pcode=451, how=18, input=0, 
    output=0, last1=0) at ../../Src/exec.c:1189
#14 0x35200 in execpline (state=0xefffe9f0, slcode=4098, how=18, last1=0)
    at ../../Src/exec.c:982
#15 0x347c8 in execlist (state=0xefffe9f0, dont_change_job=1, exiting=0)
    at ../../Src/exec.c:826
#16 0x34318 in execode (p=0x14cef8, dont_change_job=1, exiting=0)
    at ../../Src/exec.c:729
#17 0x3fa80 in runshfunc (prog=0x14cef8, wrap=0x0, 
    name=0x102958 "delete-char-or-list-new") at ../../Src/exec.c:3449
#18 0x3f704 in doshfunc (name=0x140170 "delete-char-or-list-new", 
    prog=0x14cef8, doshargs=0x0, flags=0, noreturnval=0)
    at ../../Src/exec.c:3382
#19 0xef537b94 in execzlefunc (func=0x1401a0, args=0xef572710)
    at ../../../Src/Zle/zle_main.c:696
#20 0xef53720c in zleread (lp=0xfa878 "%(2L.+.)%D{%H:%M}%(?..(%?%))%# ", 
    rp=0x0, flags=3) at ../../../Src/Zle/zle_main.c:571
#21 0x5d67c in inputline () at ../../Src/input.c:265
#22 0x5d464 in ingetc () at ../../Src/input.c:210
#23 0x4fcd4 in ihgetc () at ../../Src/hist.c:236
#24 0x669f0 in gettok () at ../../Src/lex.c:628
#25 0x65a40 in yylex () at ../../Src/lex.c:344
#26 0x91424 in parse_event () at ../../Src/parse.c:425
#27 0x58bc4 in loop (toplevel=1, justonce=0) at ../../Src/init.c:123
#28 0x5ce28 in zsh_main (argc=1, argv=0xeffff26c) at ../../Src/init.c:1200
#29 0x19c70 in main (argc=1, argv=0xeffff26c) at ../../Src/main.c:37

-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
Cambridge Silicon Radio, Unit 300, Science Park, Milton Road,
Cambridge, CB4 0XL, UK                          Tel: +44 (0)1223 392070



Messages sorted by: Reverse Date, Date, Thread, Author