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

Re: another bug in suffix removal 3.1.5

On Nov 6,  8:50am, Sven Wischnowsky wrote:
} Subject: Re: another bug in suffix removal 3.1.5
} Peter Stephenson wrote:
} > 
} > Sven Wischnowsky wrote:
} > > greg@xxxxxxxxxxxxx wrote:
} > > 
} > > > % bar <Control-a> <Control-k>   # IE, get "bar" in the kill ring
} > > > % ls f <tab>
} > > >   -> foo/ <Control-y>
} > > >   -> foobar                     # the slash got removed
} > > 
} > > another missing fixsuffix() problem.
} > 
} > Isn't it just a case of adding ZLE_KEEPSUFFIX to the flags for yank?
} Personally I would prefer zsh to leave the suffix on the line and
} automatically removable in whenever a zle widget doesn't change the
} line and cursor position. But maybe I'm the only one who would prefer
} that.

Philosophical aside:

The 3.0.5 completion mechanism decides whether to autoremove almost
entirely based on what zle-command is next invoked.  3.1.5 is trying to
get away from that in order to make the widget set extensible, which is
why we have so many of these fixsuffix() problems.  ZLE_KEEPSUFFIX is
the standard escape back into the 3.0.5 style for widgets that haven't
been taught the new requirements yet, but it's a lot more reliable and
maintainable than sprinkling fixsuffix() around has been.

Back to the topic at hand:

This brings up a general question of what should happen on a widget
failure (either a feep, or when it simply can't do anything).  For

zsh% mkdir /tmp/bar
zsh% ls /tmp/b<TAB>
zsh% ls /tmp/bar/<C-f>
zsh% ls /tmp/bar

Note that when I *tried* to move the cursor, the slash got removed,
even though the cursor couldn't actually move.  Similarly (with ^X^A
not bound to anything):

zsh% ls /tmp/b<TAB>
zsh% ls /tmp/bar/<C-xC-a>
zsh% ls /tmp/bar

I think this argues (again) for some kind of return code from widget
functions (propagated via the standard "return" builtin for user-
defined widgets) so that they can notify the line editor when they do
nothing.  This could then be handled by zleread() in the same way that
not finding any binding at all is handled (except for the feep), which
we could then fix to match Sven's preference (which is a sensible one).

Until such time as all that has happened, I think PWS's fix is fine.

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

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