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
2111142cf1
Fix a memory leak, from Japin Li in GitHub issue 3358.
2022-10-25 09:12:05 +00:00
nicm
5cdc1bdd32
Disable aliases inside aliases for the moment.
2021-09-10 08:52:46 +00:00
nicm
5a4b2fd68c
Fix parsing of aliases again (GitHub issue 2842), also make argument
...
parsing a bit simpler and fix the names of some client flags.
2021-09-09 06:57:48 +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
03b83a5a34
Key bindings steal a reference to the command instead of adding their
...
own, it was correct not to add a reference when parsing, but the
bind-key then needs to add one.
2021-08-23 11:48:21 +00:00
nicm
1f0c0914c7
Revert one of previous, for some reason it is being freed.
2021-08-23 11:08:26 +00:00
nicm
4a753dbefc
Fix a few memory leaks.
2021-08-23 11:04:21 +00:00
nicm
c0048d6d20
Insert alias in the right place, GitHub issue 2842.
2021-08-22 13:00:28 +00:00
nicm
069f5925af
Preserve argument type in command and convert to string on demand.
2021-08-21 20:46:43 +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
5241dae87d
Stop caring about empty commands, just treat as a null command.
2021-08-21 17:25:32 +00:00
nicm
c286fbdcd7
Preserve command group when moving temporary list to current list being
...
buit.
2021-08-21 14:06:17 +00:00
nicm
d589be6c65
A couple more spacing fixes.
2021-08-20 20:08:30 +00:00
nicm
f984446d19
Actually parse contents of {} as a command and then convert to a string
...
instead of just copying arguments around as strings.
2021-08-20 09:06:26 +00:00
nicm
3177d7b617
Add a helper function for actually parsing the command.
2021-08-20 06:30:57 +00:00
nicm
5413a73ded
Need to flatten arguments for aliases.
2021-08-18 15:16:33 +00:00
nicm
82836c7394
Push the conversion of {} to string up out of the parser and into the
...
command builder.
2021-08-18 10:15:08 +00:00
nicm
f0c1233d4f
Leave newlines inside multiline quotes.
2020-12-01 10:48:03 +00:00
nicm
468be2a37f
Do not dereference NULL environment variable value, GitHub issue 2304.
2020-07-13 10:10:10 +00:00
nicm
4403afe29c
A } can go on the same line as a command.
2020-06-04 16:06:01 +00:00
nicm
d3c5202f50
Allow strings to span multiple lines - newlines and any leading
...
whitespace are removed, as well as any following comments that couldn't
be part of a format. This allows long formats or other strings to be
annotated and indented.
2020-06-04 08:30:44 +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
6f03e49e68
Use the internal representation for UTF-8 keys instead of wchar_t and
...
drop some code only needed for that.
2020-05-25 18:57:24 +00:00
nicm
187277eaad
Add helpers for the simple case of parse string and add to command queue.
2020-04-13 18:59:41 +00:00
nicm
34804f2709
When parsing strings, put all commands in one group even if there are
...
newlines. This means that for example bind q { a \n b } and bind q "a ;
b" are the same. Also log commands in different groups separated by ;;
rather than ; (a command list like this should never be user visible).
2020-04-13 16:19:37 +00:00
nicm
cc8b41f294
Add a way to mark environment variables as "hidden" so they can be used
...
by tmux but are not passed into the environment of new panes.
2020-03-31 17:14:40 +00:00
nicm
e388702260
Ignore empty commands rather than adding them to the command list rather
...
than trying to skip them later, fixes problem reported by M Kelly.
2020-01-28 13:10:14 +00:00
nicm
2e39b621c9
Change so that assignments may be specified alone - a command isn't
...
required. GitHub issue 2062.
2020-01-27 08:23:42 +00:00
nicm
2b2b193791
Add function to the right file.
2019-12-12 15:01:54 +00:00
nicm
68d59a16ce
Memory leaks, from Igor Wong in GitHub issue 1934.
2019-10-14 08:38:07 +00:00
nicm
f4c7141f5d
Do not lazily use BUFSIZ for "I don't care what size" when building
...
strings because it is only guaranteed to be 256 bytes and even the
default 1024 is not always enough. Reported by Gregory Pakosz.
2019-10-03 10:24:05 +00:00
nicm
4b7e97ba53
Set up format tree for %if, GitHub issue 1896.
2019-09-10 07:50:33 +00:00
nicm
250fdd08be
Handle comments more correctly inside {}, from Avi Halachmi.
2019-06-18 11:17:40 +00:00
nicm
d1d3bbb458
Show filename with -v for source-file.
2019-06-14 13:34:45 +00:00
nicm
45203582ff
A couple of minor parser changes around conditions: 1) only treat #{
...
specially after a condition, otherwise as a comment (which is more as
most people expect) 2) allow formats to be quoted after a condition.
2019-06-14 12:04:11 +00:00
nicm
8f40796f05
Add a -v flag to source-file to show the commands and line numbers.
2019-06-05 20:00:53 +00:00
nicm
900238a306
yacc(1) copies its union so it is not a good place to store
...
TAILQ_HEADs. Allocate them instead. Found from a problem reported by
sthen@.
2019-06-02 07:10:15 +00:00
nicm
39ea8a2787
Need stdlib.h, from Ben Boeckel.
2019-06-01 06:20:22 +00:00
nicm
82e47403c6
Allow % strings that are all numbers or %s, and fix a double free. Both
...
reported by George Nachman, GitHub issues 1765 and 1766.
2019-05-31 11:34:09 +00:00
nicm
8fb796b5b3
No longer need to reduce line number by one.
2019-05-30 10:04:33 +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
c17edd594e
The line number needs to be updated only after the \n is processed by
...
the parser, so store a flag and update it next time around. Also each
new line needs its own shared data.
2019-05-29 19:34:42 +00:00
nicm
a4424fbebf
Support \ooo escapes, from Avi Halachmi.
2019-05-29 10:08:36 +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
6dee409981
Some other platforms doesn't support fmemopen(3) (not unexpectedly), so
...
don't use it - since we only use getc/ungetc on the file anyway it is
easy not to.
2019-05-26 10:08:50 +00:00
nicm
f8d3d247d8
Merge cmd_list_parse into cmd-parse.y so it can use the new alias
...
processing code.
2019-05-25 07:18:20 +00:00
nicm
f3e01ecc42
Fix line numbers - commands are added after the line ends so they need to
...
get line - 1.
2019-05-23 18:39:00 +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
723010ba72
Replace the split parser code (cfg.c and cmd-string.c) with a single
...
parser using yacc(1). This is a major change but is clearer and simpler
and allows some edge cases to be made more consistent, as well as
tidying up how aliases are handled. It will also allow some further
improvements later.
Entirely the same parser is now used for parsing the configuration file
and for string commands. This means that constructs previously only
available in .tmux.conf, such as %if, can now be used in string commands
(for example, those given to if-shell - not commands invoked from the
shell, they are still parsed by the shell itself).
The only syntax change I am aware of is that #{} outside quotes or a
comment is now considered a format and not a comment, so #{ is now a
syntax error (notably, if it is at the start of a line).
This also adds two new sections to the man page documenting the syntax
and outlining how parsing and command execution works.
Thanks to everyone who sent me test configs (they still all parse
without errors - but this doesn't mean they still work as intended!).
Thanks to Avi Halachmi for testing and man page improvements, also to
jmc@ for reviewing the man page changes.
2019-05-23 11:13:30 +00:00