summaryrefslogtreecommitdiffstats
path: root/cmd-command-prompt.c
AgeCommit message (Collapse)Author
2011-07-08Make confirm-before prompt customizable with -p option likeNicholas Marriott
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.
2011-07-03Include the existing window and session name in the prompt when renamingNicholas Marriott
and add a new key binding ($) for rename session. From Tiago Cunha.
2011-07-02Allow the initial context on prompts to be set with the new -I option toNicholas Marriott
command-prompt. From Tiago Cunha.
2011-05-20Pass prompts through status_replace so that they can be more helpfulNicholas Marriott
(such as showing the previous session name when renaming). From Tiago Cunha.
2011-01-05Whoops, command-prompt can take 0 or 1 argument.Nicholas Marriott
2011-01-04Clean up and simplify tmux command argument parsing.Nicholas Marriott
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.
2010-05-05Identical behaviour to select-prompt can now be obtained withNicholas Marriott
command-prompt, so remove select-prompt and change ' to be bound to command-prompt -p index "select-window -t :%%".
2009-11-13Get rid of the ugly CMD_CHFLAG macro and use a const string (eg "dDU") in theNicholas Marriott
command entry structs and a couple of functions to check/set the flags.
2009-09-21Use KEYC_NONE constant instead of 0 on init.Nicholas Marriott
2009-08-25Add a choose-client command and extend choose-{session,window} to accept aNicholas Marriott
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).
2009-08-23The cursession member in struct cmd_ctx is always either curclient->session orNicholas Marriott
NULL when curclient is also NULL, so just eliminate it.
2009-08-19Extend command-prompt with a -p option which is a comma-separated list of oneNicholas Marriott
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.
2009-08-13Switch the prompt code to return an empty string when the user enters noNicholas Marriott
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.
2009-07-26Make all messages sent between the client and server fixed size.Nicholas Marriott
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.
2009-07-20Kill some dead stores and fix a null pointer deref, found by clang.Nicholas Marriott
2009-07-17Memory could be leaked if a second prompt or message appeared while another wasNicholas Marriott
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.
2009-07-15Make status_message_set a variadic printf-like function. No functional change -Nicholas Marriott
helpful for a couple of things coming soon.
2009-07-13Having fixed flags for single-character getopt options is a bit hard toNicholas Marriott
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.
2009-06-01Import tmux, a terminal multiplexor allowing (among other things) a singleNicholas Marriott
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