but there is also now a global command queue. Instead of command queues
being dispatched on demand from wherever the command happens to be
added, they are now all dispatched from the top level server
loop. Command queues may now also include callbacks as well as commands,
and items may be inserted after the current command as well as at the end.
This all makes command queues significantly more predictable and easier
to use, and avoids the complex multiple nested command queues used by
source-file, if-shell and friends.
A mass rename of struct cmdq to a better name (cmdq_item probably) is
coming.
confusing, particularly trying to automatically figure out what target
hooks should be using. So simplify it:
- drop before hooks entirely, they don't seem to be very useful;
- commands with special requirements now fire their own after hook (for
example, if they change session or window, or if they have -t and -s
and need to choose which one the hook uses as current target);
- commands with no special requirements can have the CMD_AFTERHOOK flag
added and they will use the -t state.
At the moment new-session, new-window, split-window fire their own hook,
and display-message uses the flag. The remaining commands still need to
be looked at.
- Prepare the state again before the "after" hooks are run, because the
command may have killed or moved windows.
- Use the hooks list from the newly prepared target, not the old hooks
list (only matters for new-session really).
- Correctly detect an invalid current state and ignore it in
cmd_find_target ("killw; swapw").
- Change neww, new, killp, killw, splitw, swapp, swapw to update the
current state (used if no explicit target is given) to something more
useful after they have finished. For example, neww changes it to the
newly created window.
Hooks are still relatively new and primitive so there are likely to be
more changes to come.
Parts based on bug reports from Uwe Werler and Iblis Lin.
the state (client, session, winlink, pane) for it it before entering the
command. Each command provides some flags that tell the prepare step
what it is expecting.
This is a requirement for having hooks on commands (for example, if you
hook "select-window -t1:2", the hook command should to operate on window
1:2 not whatever it thinks is the current window), and should allow some
other target improvements.
The old cmd_find_* functions remain for the moment but that layer will
be dropped later.
Joint work with Thomas Adam.
around, we can't use file descriptors for the working directory because
we will be unable to pass it to a privileged process to tell it where to
read or write files or spawn children. So move tmux back to using
strings for the current working directory. We try to check it exists
with access() when it is set but ultimately fall back to ~ if it fails
at time of use (or / if that fails too).
directly with a helper function in the cmd_entry, include a table of
bind-key commands and pass them through the command parser and a
temporary cmd_q.
As well as being smaller, this will allow default bindings to be command
sequences which will probably be needed soon.