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

PATCH: line building cleanup



When the completion code tries to build a string to insert in the line 
it uses the match specs currently in use. These specs are stored in a
variable called `mstack' in tricky.c. However, we can't use this
variable directly since the completion-adding builtins may have their
own `local' specs. So for building the string we have to keep track of 
a different set of specs to use. Previously I used another stack
(`bmstack') for this, but after playing with it at the weekend it
became clear that this gave up too early (I had feared that already
but was rather fed up with the code at that time). So the patch below
improves this by keeping a list of specs to use and trying hard to
remove entries from this list as late as possible.

Also, it fixes a small memory problem with `compadd' (if used with
`-M').

For all this I didn't have to change many lines, but the different
match-spec code allowed me to replace two nested loop with one loop in 
several places. The re-indentation after that made the patch quite
long, so I have compressed it. I apologise for the inconvenience.

Bye
 Sven

begin 600 patch-comp-fix.gz
M'XL("$4MT38"`W!A=&-H+6-O;7`M9FEX`.T]:7?;1I*?Z5_1G@\**9`.2=W1
MYO`Z\<3['&=FDFS>;G:>%B1!"1$N`Z`99:/_OG7U!8"4*.?T1,^6P#ZKJZKK
M;#07\7*I1BN55^__=Q*]_V,27=1E/+^^>3)77Y7S5N&CT6C4U;CW19ZIY]%,
M3:=J,O[@\.R#@T,U.3L[>Q0$0>=(7H_)!^.3#\9C[O'))VHTG1P.)Q,5X-\S
M]<DGC]0C]?Z^^OHJ4O,\+9*HCJ%[&M;SJZBLU*J*%FI]%65JMHJ319Q=JBQ:
MJZI>P?*6>:EJZ)C$6?1$[;\/8XVJ.JSC.30H5_-:S=,DKFHU2Z%X?CT>ZJ?)
MN6GYS&MBR^.L5E?AXB))SQ\%S;8"WCG."-`_552^CNLK54;+J(RR>52I.E=A
MDNC%J'5$RR%(@_OVJKQN@"P!Y66<7;_$[BXLB.#)T?')\%@%\/=H>'I`*,:?
M_:0LU(<JR:#A+;0-".MQ16@/2YQXG:MY$=9U5&8$6J7";`&@U:LRJU269Z,?
MHS)7\1*Q?J.@TZ-`[:OH]2I,>%4&4X"]1\$\+2[T@%7_F1XZ'"KS/!L\"OX/
M1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