Commit Graph

163 Commits

Author SHA1 Message Date
Maxime Coste
ddc307b8e9 Optimize CommandManager::execute handling of tokens
Instead of walking a list of tokens and inserting eventual new
ones in the middle, use a stack of token and push new ones on top.
2017-10-17 10:25:20 +08:00
Maxime Coste
64183b1e4c Make Token a simple aggregate 2017-09-01 17:09:34 +07:00
Maxime Coste
ab6a999431 Rename containers.hh to ranges.hh (and Container to Range) 2017-08-29 15:23:03 +07:00
Maxime Coste
eb2984807c Remove some dead code 2017-06-29 07:43:20 +01:00
Frank LENORMAND
8d24768d5d src: Add a commands debug flag
This commit allows setting the `commands` flag to the `debug` option, in
order to have the engine write on the *debug* buffer the commands that are
being executed, along with their arguments.
2017-06-17 11:27:07 +03:00
Maxime Coste
575e6fe325 Remove unneeded unknown_expand exception type 2017-06-07 19:01:26 +01:00
Maxime Coste
a0d848da8d Do not allow whitespaces as % string delimiters 2017-06-07 13:09:45 +01:00
Maxime Coste
261e0fabcc Improve readability of command docstrings by changing formatting
Fixes #1378
2017-06-04 08:37:51 +01:00
Maxime Coste
f014eb7052 Fix command parsing bug when commenting after a command
When a comment was present directly on the same line after a command,
we did not correctly see the command as terminated and would join
continue parsing the next line.
2017-05-25 08:30:49 +01:00
Maxime Coste
6a97455b3b Do not push a final spurious command separators when parsing commands
Fixes #1336
2017-05-08 11:46:03 +01:00
Maxime Coste
3a3144f3f5 Fix use of invalidated iterator in the command map on exception
The command map can get mutated by command execution, so the iterators
can get invalidated (now that we use our curstom HashMap implementation,
all iterators are potentially invalidated by insert/removal)
2017-05-07 16:25:34 +01:00
Maxime Coste
5103b15b84 Safer code for parsing commands
Fix some possible past the end of target string reads
Fixes #1310 (maybe, probably, who knows)
2017-04-19 22:04:03 +01:00
Maxime Coste
c1c40a4b56 Remove some now unneeded uses of const String& params
HashMap supports finding String from StringView.
2017-04-10 21:33:20 +01:00
Maxime Coste
e44f95820e Fixes some clang-tidy warning and add a few missing meta.hh include 2017-03-16 23:34:02 +00:00
Maxime Coste
7d9f1df73a Small code tweaks regarding flags handling 2017-03-15 18:25:59 +00:00
Maxime Coste
6373338c50 Replace uses of UnorderedMap with HashMap 2017-03-07 01:03:26 +00:00
Maxime Coste
2052b225d9 Detect too deep command call stack
Fixes #1163
2017-01-29 13:56:05 +00:00
Maxime Coste
753f3a50d1 Make StringView and unit types trivial types 2017-01-29 13:49:45 +00:00
Maxime Coste
9f0bca53c4 Small code cleanups 2017-01-08 23:26:15 +00:00
Maxime Coste
dcd8f6ef01 Apply clang-tidy modernize to the codebase 2017-01-08 22:39:01 +00:00
Maxime Coste
84c2ca1cdc Merge remote-tracking branch 'leira/empty_param_crash' 2016-12-27 22:00:32 +00:00
Leira Hua
f79018cffd Added string length check when checking switch params
Fixes #1051
2016-12-24 17:42:31 -08:00
Maxime Coste
d17bed9b80 Display the command prompt in error face when the command is not found
Fixes #1021
2016-12-23 16:23:31 +00:00
Maxime Coste
03eb128536 Ensure content of expanded strings in modelinefmt is not interpreted as markup 2016-12-07 20:07:32 +00:00
Maxime Coste
2f704eab16 Small command parsing refactoring 2016-12-07 13:26:11 +00:00
Maxime Coste
47a82b9855 Make ArrayView::subrange size arguement optional 2016-11-20 11:15:15 +00:00
Maxime Coste
5249df78d4 Do not include aliases in command completion candidates anymore
Fuzzy matching makes it redundant.
Closes #817
2016-11-14 00:29:43 +00:00
Maxime Coste
025b91baca Convert some uses of lambda to more concise std::mem_fn 2016-10-10 23:44:18 +01:00
Maxime Coste
35559b65dd Support codepoints of variable width
Add a ColumnCount type and use it in place of CharCount whenever
more appropriate, take column size of codepoints into account for
vertical movements and docstring wrapping.

Fixes #811
2016-10-01 13:45:00 +01:00
Maxime Coste
d14c39ebdd Rewrite PerArgumentCommandCompleter to use compile time dispatching
No need to store these vectors of std::functions around anymore.
2016-09-18 16:07:00 +01:00
Maxime Coste
5b7b6eebaf Regenerate shell-candidates for each completion sessions
That should allow fixing the #665 issue while still avoiding to
run a potentially long shell command on each keystroke.
2016-08-05 13:53:19 +01:00
Maxime Coste
471c75d738 Trim trailing end of lines in %sh outputs
Fixes #698
2016-06-19 17:01:56 +01:00
Maxime Coste
2435949fae Add support for env var name completion
Fixes #659
2016-04-17 19:21:43 +01:00
Maxime Coste
1d646c03f5 Add completion support for alias/unalias commands 2016-03-24 00:05:40 +00:00
Maxime Coste
9e15181dc9 Rework container helpers, use pipe syntax and cleanup implementation
use 'container | filter(func) | reverse() | transform(func)' instead
of 'transform(reverse(filter(container), func), func)' to express
container transformations.
2016-03-08 21:35:56 +00:00
Maxime Coste
21ae662151 Use ranked match based completion for command names 2016-03-08 13:56:37 +00:00
Maxime Coste
5b9d30c088 Optimize the dynregex case where the expression refers directly to a regex option 2015-12-12 06:50:58 +00:00
Maxime Coste
2a8a329b83 Remove support for %arg{#}, can be added back if we got a use case
It is very unlikely we need %arg{#} without needing a %sh anyway.
2015-12-02 01:08:41 +00:00
Maxime Coste
a02ad38fb4 Forward each params in %arg{@} separately 2015-12-02 01:01:48 +00:00
Maxime Coste
b2648053f9 Add argument expansion support 2015-12-01 20:07:14 +00:00
Maxime Coste
cb108b248a Fix alias completion and overwritting 2015-11-17 13:55:27 +00:00
Maxime Coste
5118e13aee Remove useless std::move 2015-10-23 13:46:55 +01:00
Maxime Coste
da7fc3311f Pass ShellContext to commands
Fix #427
2015-10-22 13:59:23 +01:00
Maxime Coste
e51ef6c3c2 Wrap the shell params en env vars in a ShellContext struct 2015-10-22 13:48:57 +01:00
Maxime Coste
01152d7cd9 Improve escaping of % in command parsing 2015-09-20 11:48:11 +01:00
Maxime Coste
574e337132 Improve command completion by taking into account quoting of arguments 2015-09-20 11:19:10 +01:00
Maxime Coste
e7a8f64722 Use a sorted IdMap for aliases 2015-09-16 22:32:02 +01:00
Maxime Coste
693d9a4861 Store key hash in IdMap 2015-09-16 20:02:12 +01:00
Maxime Coste
30ad9a0475 Complete aliases in command prompt 2015-09-06 18:09:32 +01:00
Maxime Coste
64c21b93a5 Additional code tweak in command_manager.cc 2015-08-29 21:39:23 +01:00