Commit Graph

63 Commits

Author SHA1 Message Date
nicm 8643ece345 Fix memory leak, from Fadi Afani. 2024-05-13 11:45:05 +00:00
nicm e8530c9fee Fixes for memory leaks reported by Lu Ming Yin, fixes from Howard Chu. 2024-04-15 08:19:55 +00:00
nicm 4dea352dee Don't strdup NULL filename. 2023-11-14 20:01:11 +00:00
nicm 88fd1f00b8 Handle NULL client (in config file) when showing a status message; also
copy the file when processing if-shell since it may be freed. GitHub
issue 3746.
2023-11-14 15:59:49 +00:00
nicm a2a02fd7d7 Change a few types to fix warnings, from Thomas Klausner. 2023-06-30 21:55:08 +00:00
nicm ac4bb89d43 Fix command prompt not to always append argument but only if there has
actually been expansion. GitHub issue 3493.
2023-03-15 08:15:39 +00:00
nicm 565de3f54b Fix parsing of optional arguments so that and accept a - starting an
argument.
2023-01-08 23:34:46 +00:00
nicm 3b3f42053a Add send-keys -K to handle keys directly as if typed (so look up in key
table). GitHub issue 3361.
2022-12-16 08:13:40 +00:00
nicm 33c59100ae Fix validation of missing percentage arguments. 2022-08-02 09:23:34 +00:00
nicm c07d582e24 Expand arguments to some commands where it makes sense, GitHub issue
3204 from Anindya Mukherjee.
2022-06-07 10:02:19 +00:00
nicm 006a529db1 Check if args_strtonum argument is NULL or not a string, from Anindya
Mukherjee.
2022-05-30 13:04:24 +00:00
nicm 7d4224f207 Allow optional arguments. 2022-03-03 08:24:12 +00:00
nicm 200b6536e1 fatalx on unknown enum members in a couple of places, from Ben Boeckel. 2021-11-02 10:57:04 +00:00
nicm 768fb9080f Keep -? as usage. 2021-09-09 21:55:03 +00:00
nicm 34312fd6ee Expand argument to run-shell again. 2021-09-09 13:38:32 +00:00
nicm 329c2c2a91 Change copying arguments to that flags without arguments are inserted
correctly and empty arguments lists do not crash. Fixes crash reported
by & ok mpi@.
2021-09-02 07:11:03 +00:00
nicm daec63e5e6 Replace %% in command lists (by copying them) for template arguments ,
this means they can be used with {} as well. Also make argument
processing from an existing vector preserve commands. GitHub issue 2858.
2021-08-27 17:25:55 +00:00
nicm 03d173cbd8 Validate command argument types (string or command list) and give more
useful error messages.
2021-08-25 08:51:55 +00:00
nicm 841ce74b43 args_make_commands_now needs to take an extra reference to the returned
command list since it will be freed already.
2021-08-23 17:05:43 +00:00
nicm 210e71edf3 Move command argument parsing common functions and don't bother to parse
again if given a command rather than a string.
2021-08-23 12:33:55 +00:00
nicm 0084cbef5a Free value properly. 2021-08-21 20:57:52 +00:00
nicm 326d2ef234 Pass typed arguments out of the parser into the arguments list and let
it convert them into strings.
2021-08-21 18:39:07 +00:00
nicm 110ba767e5 Rename a member to match what it will be in future. 2021-08-21 10:28:05 +00:00
nicm d371764d02 Wrap command argument definitions in their own struct. 2021-08-21 08:44:59 +00:00
nicm d589be6c65 A couple more spacing fixes. 2021-08-20 20:08:30 +00:00
nicm 5f32b7d961 Hide struct args behind a couple of accessor functions. 2021-08-20 19:50:16 +00:00
nicm 90dd474c3e Expose args_value struct (will be needed soon) and add some missing frees. 2021-08-20 18:59:53 +00:00
nicm 6cbc83c6a6 Add a way to create an empty arguments set. 2021-08-20 17:53:54 +00:00
nicm cf63465eb0 Fix quoting with newlines and single quotes. 2020-06-12 07:10:43 +00:00
nicm b3782d2dc8 Instead of using a custom parse function to process {}, treat it as a
set of statements and parse with yacc, then convert back to a string as
the last step. This means the rules are consistent inside and outside
{}, %if and friends work at the right time, and the final result isn't
littered with unnecessary newlines.
2020-06-04 07:12:05 +00:00
nicm dc893405e1 Fix some error strings, from Kris Katterjohn. 2020-05-25 18:17:14 +00:00
nicm beb214bcb3 Add formats for after hook command arguments. 2020-05-16 15:40:04 +00:00
nicm de5163a634 Change so main-pane-width and height can be given as a percentage. 2020-04-22 06:57:13 +00:00
nicm ad38ef6ff4 Print empty arguments properly. 2020-04-12 20:54:28 +00:00
nicm 8828b958f0 Break code to convert an argument as a percentage into a common function. 2020-03-21 13:16:15 +00:00
nicm bd0342b0a7 getopt is not required to set optarg to NULL when there is no argument
and some do not, so set it explicitly each time.
2020-03-17 16:02:38 +00:00
nicm fc2016dbb6 Add a -H flag to send-keys to send literal keys given as hex numbers
(needed for control clients to send mouse sequences). Also add some
format flags for UTF-8 and SGR mouse mode. Requested by Bradley Smith in
GitHub issues 1832 and 1833.
2019-07-09 14:03:12 +00:00
nicm cd1fc42df6 Add a -A flag to show-options to show parent options as well. 2019-06-20 07:10:56 +00:00
nicm 7dced37673 Use VIS_CSTYLE for the arguments and add the missing escapes it can
generate to the parser.
2019-05-29 20:05:14 +00:00
nicm 4382538e4b Do not read past the end of the argument string if it is empty. 2019-05-28 18:30:30 +00:00
nicm 6b332127ca Add an additional {} syntax for defining strings in the configuration
file, making it much tidier to define commands that contain other tmux
or shell commands (like if-shell). Also tweak bind-key to expect a
string if it is only given one argument, so {} can be used with it as
well. From Avi Halachmi.
2019-05-27 12:16:27 +00:00
nicm 27bfb56ad5 Break the argument escaping code into a separate function and use it to
escape key bindings in list-keys. Also escape ~ and ; and $ properly.
2019-05-23 14:03:44 +00:00
nicm c4b0da5513 Support multiple occurances of the same argument. Use this for a new
flag -e to new-window, split-window, respawn-window, respawn-pane to
pass environment variables into the newly created process. From Steffen
Christgau in GitHub issue 1697.
2019-04-28 20:05:50 +00:00
nicm e1b3dc89d2 Run alert hooks based on the options rather than unconditionally, from
Brad Town.
2017-08-23 09:14:21 +00:00
nicm aad4e4ddb1 Rewrite of choose mode, both to simplify and tidy the code and to add
some modern features.

Now the common code is in mode-tree.c, which provides an API used by the
three modes now separated into window-{buffer,client,tree}.c. Buffer
mode shows buffers, client mode clients and tree mode a tree of
sessions, windows and panes.

Each mode has a common set of key bindings plus a few that are specific
to the mode. Other changes are:

- each mode has a preview pane: for buffers this is the buffer content
  (very useful), for others it is a preview of the pane;

- items may be sorted in different ways ('O' key);

- multiple items may be tagged and an operation applied to all of them
  (for example, to delete multiple buffers at once);

- in tree mode a command may be run on the selected item (session,
  window, pane) or on tagged items (key ':');

- displayed items may be filtered in tree mode by using a format (this
  is used to implement find-window) (key 'f');

- the custom format (-F) for the display is no longer available;

- shortcut keys change from 0-9, a-z, A-Z which was always a bit weird
  with keys used for other uses to 0-9, M-a to M-z.

Now that the code is simpler, other improvements will come later.

Primary key bindings for each mode are documented under the commands in
the man page (choose-buffer, choose-client, choose-tree).

Parts written by Thomas Adam.
2017-05-30 21:44:59 +00:00
nicm ae1a6c2fc5 Do not need getopt.h. 2017-04-22 12:08:41 +00:00
nicm faa0570309 Plain stravis() because it will mangle UTF-8 characters, so add
utf8_stravis() which calls our existing utf8_strvis() and use it instead
2017-01-18 10:08:05 +00:00
nicm 4bb5a1d6a7 Run arguments through vis() as well when printing them. 2017-01-18 10:00:50 +00:00
nicm e45401846f Add static in window-*.c and move some internal functions out of tmux.h. 2016-10-11 13:21:59 +00:00
nicm 7d4b416fe6 Some more static. 2016-10-10 13:54:47 +00:00