summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/cmd-command-prompt.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Instead of setting up the default keys by building the key structnicm2014-10-201-31/+1
| | | | | | | | | 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.
* Remove the barely-used and unnecessary command check() function.nicm2013-10-101-3/+1
|
* Add a command queue to standardize and simplify commands that call othernicm2013-03-241-13/+6
| | | | | | | | | | | | | | | | | | | | | | commands and allow a command to block execution of subsequent commands. This allows run-shell and if-shell to be synchronous which has been much requested. Each client has a default command queue and commands are consumed one at a time from it. A command may suspend execution from the queue by returning CMD_RETURN_WAIT and then resume it by calling cmd_continue() - for example run-shell does this from the callback that is fired after the job is freed. When the command queue becomes empty, command clients are automatically exited (unless attaching). A callback is also fired - this is used for nested commands in, for example, if-shell which can block execution of the client's cmdq until a new cmdq becomes empty. Also merge all the old error/info/print functions together and lose the old curclient/cmdclient distinction - a cmdq is bound to one client (or none if in the configuration file), this is a command client if c->session is NULL otherwise an attached client.
* Fix error reporting for client commands by adding a flag tonicm2013-03-241-2/+2
| | | | | cmd_find_client to tell it whether or not to show errors, sometimes it's needed and sometimes not.
* Need to set clients in context before changing their reference count.nicm2013-03-221-3/+2
|
* Remove unnecessary initializers of cmd_ctx.nicm2013-03-221-4/+1
|
* Add functions to allocate and free command contexts rather than doing itnicm2013-03-221-10/+11
| | | | all on the stack.
* Make command exec functions return an enum rather than -1/0/1 values andnicm2012-07-111-6/+6
| | | | | | add a new value to mean "leave client running but don't attach" to fix problems with using some commands in a command sequence. Most of the work by Thomas Adam, problem reported by "jspenguin" on SF bug 3535531.
* xfree is not particularly helpful, remove it. From Thomas Adam.nicm2012-07-101-12/+10
|
* Make confirm-before prompt customizable with -p option likenicm2011-07-081-32/+9
| | | | | | command-prompt. Also move responsibility for calling status_replace into status_prompt_{set,update} and add #W and #P to the default kill-window and kill-pane prompts. By Tiago Cunha.
* Include the existing window and session name in the prompt when renamingnicm2011-07-031-1/+6
| | | | and add a new key binding ($) for rename session. From Tiago Cunha.
* Allow the initial context on prompts to be set with the new -I option tonicm2011-07-021-13/+49
| | | | command-prompt. From Tiago Cunha.
* Pass prompts through status_replace so that they can be more helpfulnicm2011-05-201-5/+14
| | | | | (such as showing the previous session name when renaming). From Tiago Cunha.
* Whoops, command-prompt can take 0 or 1 argument.nicm2011-01-051-2/+2
|
* Clean up and simplify tmux command argument parsing.nicm2011-01-041-117/+35
| | | | | | | | | | | | | | | | | | | Originally, tmux commands were parsed in the client process into a struct with the command data which was then serialised and sent to the server to be executed. The parsing was later moved into the server (an argv was sent from the client), but the parse step and intermediate struct was kept. This change removes that struct and the separate parse step. Argument parsing and printing is now common to all commands (in arguments.c) with each command left with just an optional check function (to validate the arguments at parse time), the exec function and a function to set up any key bindings (renamed from the old init function). This is overall more simple and consistent. There should be no changes to any commands behaviour or syntax although as this touches every command please watch for any unexpected changes.
* Identical behaviour to select-prompt can now be obtained withnicm2010-05-051-1/+5
| | | | | command-prompt, so remove select-prompt and change ' to be bound to command-prompt -p index "select-window -t :%%".
* Get rid of the ugly CMD_CHFLAG macro and use a const string (eg "dDU") in thenicm2009-11-131-2/+2
| | | | command entry structs and a couple of functions to check/set the flags.
* Use KEYC_NONE constant instead of 0 on init.nicm2009-09-211-2/+2
|
* Add a choose-client command and extend choose-{session,window} to accept anicm2009-08-251-43/+2
| | | | | | | | | | | template. After a choice is made, %% (or %1) in the template is replaced by the name of the session, window or client suitable for -t and the result executed as a command. So, for example, "choose-window "killw -t '%%'"" will kill the selected window. The defaults if no template is given are (as now) select-window for choose-window, switch-client for choose-session, and detach-client for choose-client (now bound to D).
* The cursession member in struct cmd_ctx is always either curclient->session ornicm2009-08-231-2/+1
| | | | NULL when curclient is also NULL, so just eliminate it.
* Extend command-prompt with a -p option which is a comma-separated list of onenicm2009-08-191-75/+197
| | | | | | | | | | | | | | | | | | or more prompts to present in order. The responses to the prompt are replaced in the template string: %% are replaced in order, so the first prompt replaces the first %%, the second replaces the second, and so on. In addition, %1 up to %9 are replaced with the responses to the first the ninth prompts The default template is "%1" so the response to the first prompt is processed as a command. Note that this changes the behaviour for %% so if there is only one prompt, only the first %% will be replaced. Templates such as "neww -n '%%' 'ssh %%'" should be changed to "neww -n '%1' 'ssh %1'". From Tiago Cunha.
* Switch the prompt code to return an empty string when the user enters nonicm2009-08-131-2/+2
| | | | | | | response and reserve NULL for an explicit cancel. Change all callbacks to treat them the same so no functional change. Also add cancel key bindings to emacs mode which were missing.
* Make all messages sent between the client and server fixed size.nicm2009-07-261-3/+1
| | | | | | | | | | | | | | This is the first of two changes to make the protocol more resilient and less sensitive to other changes in the code, particularly with commands. The client now packs argv into a buffer and sends it to the server for parsing, rather than doing it itself and sending the parsed command data. As a side-effect this also removes a lot of now-unused command marshalling code. Mixing a server without this change and a client with or vice versa will cause tmux to hang or crash, please ensure that tmux is entirely killed before upgrading.
* Kill some dead stores and fix a null pointer deref, found by clang.nicm2009-07-201-1/+3
|
* Memory could be leaked if a second prompt or message appeared while another wasnicm2009-07-171-8/+16
| | | | | | | | | | | still present, so add a separate prompt free callback and make the _clear function responsible for calling it if necessary (rather than the individual prompt callbacks). Also make both messages and prompts clear any existing when a new is set. In addition, the screen could be modified while the prompt is there, restore the redraw-entire-screen behaviour on prompt clear; add a comment as a reminder.
* Make status_message_set a variadic printf-like function. No functional change -nicm2009-07-151-2/+2
| | | | helpful for a couple of things coming soon.
* Having fixed flags for single-character getopt options is a bit hard tonicm2009-07-131-2/+2
| | | | | | | | | maintain and is only going to get worse as more are used. So instead, add a new uint64_t member to cmd_entry which is a bitmask of upper and lowercase options accepted by the command. This means new single character options can be used without the need to add it explicitly to the list.
* Import tmux, a terminal multiplexor allowing (among other things) a singlenicm2009-06-011-0/+178
terminal to be switched between several different windows and programs displayed on one terminal be detached from one terminal and moved to another. ok deraadt pirofti