summaryrefslogtreecommitdiff
path: root/src/command_manager.cc
AgeCommit message (Collapse)Author
2018-08-29Use shell specific quoting for env varsMaxime Coste
Add a test case to validate roundtrips between Kakoune and the shell.
2018-08-26Try to complete command switches when an argument starts with '-'Maxime Coste
Fixes #1467
2018-07-25Micro optimize command parsing by avoiding utf8 decodingMaxime Coste
Balanced quoted parsing does not need to decode utf8, neither does unquoted word parsing. This improves startup time a bit, helping for issue #2152
2018-07-05Fix auto escaping of command argument completionMaxime Coste
2018-07-05Expand %reg{} inside double quotes only to the main selection valueMaxime Coste
2018-07-05Make register expansions expand to the full register contentMaxime Coste
Now that we have a nice standard way to express lists of strings, registers can be fully exposed. An new $kak_main_reg_... env var was added to provide the previous behaviour which is relied on by doc.kak.
2018-07-05Change option lists to be specified as separate arguments on commands lineMaxime Coste
Option lists and maps are specified using separate arguments, avoiding the need for additional escaping of their separator and reusing the existing command line spliting logic instead. As discussed on #2087, this should make it much easier to work with list options, and make the general option system feel cleaner.
2018-07-05Make expansion of strings support quoting of % by doubling upMaxime Coste
2018-07-05Refactor command line parsingMaxime Coste
Command line parsing now works as follow: * Quoted strings ('...', "..." and %~...~ with '~' non nestable) use 'doubling-up' for escaping their delimiter, if the delimiter appears twice in a row, it is considered as part of the string and represent one delimiter character. So 'abc''def' == "abc'def". No other escaping takes place in those strings. * Balanced strings (%{...}) do not support any kind of escaping, but finds the matching closing delimiter by taking nesting into account. So %{abc{def}} == "abc{def}". * Non quoted words support escaping of `;` and whitespaces with `\`, `%`, `'` and '"` can be escaped with `\` at the start of the word, they do not need escaping (and will not be escaped) else where in a word where they are treated literally. Any other use of '\' is a literal '\'. So \%abc%\;\ def == "%abc%; def" As discussed in #2046 this should make our command line syntax more robust, provide a simple programmatic way to escape a string content (s/<delim>/<delim><delim>/g), be well defined instead of ad-hoc undocumented behaviour, and interact nicely with other common escaping by avoiding escaping hell (:grep <regex> can in most case be written with the regex unquoted).
2018-07-05Do not reparse %sh{...} stringsMaxime Coste
Automatic reparsing of %sh{...}, while convenient in many cases, can be surprising as well, and can lead to security problems: 'echo %sh{ printf "foo\necho bar" }' runs 'echo foo', then 'echo bar'. we make this danger explicit, and we fix the 'nop %sh{...}' pattern. To reparse %sh{...} strings, they can be passed to evaluate-commands, which has been fixed to work in every cases where %sh{...} reparsing was used..
2018-05-26Rework `fail` command not to display command call stackMaxime Coste
`fail` triggers "expected" errors, and hence should just display the provided message.
2018-05-26Do not expose C++ typeid().name to user facing errors on wrong option typeMaxime Coste
Fixes #2079
2018-04-06Make error messages more consistentDelapouite
2018-03-27Simplify command debug codeMaxime Coste
2018-03-18Fix crash on expanding command line stringsMaxime Coste
2018-03-13ranges: Add transform overload taking directly a pointer to memberMaxime Coste
This overload will forward to the general transform implementation using std::mem_fn to generate a callable.
2018-02-20Re-introduce aliases in command name completionMaxime Coste
Aliases are considered again in command name completion, but only if they are more than 3 charactes long. This should prevent cluttering with aliases while still letting long ones being completed.
2018-02-19Fix bug in command parsing post refactoringMaxime Coste
Fixes #1857
2018-02-18CommandManager: unescape % while parsing the stringMaxime Coste
2018-02-15CommandManager: refactor parsing of commands to iterate through tokensMaxime Coste
Avoid storing a big vector of tokens, read them one by one, and store only the current command.
2018-02-09CommandManager: Use byte rather than columns for token positionsMaxime Coste
Not only are display columns rarely used to give error positions, but they make the parsing much slower as for each token we need to compute the column in the line.
2018-02-06Fix parsing of percent tokens with unicode separatorsMaxime Coste
2018-02-04CommandManager: parse command lines as utf8 instead of asciiMaxime Coste
Fixes #1829
2017-11-04CommandManager: tweak namingMaxime Coste
2017-10-17Optimize CommandManager::execute handling of tokensMaxime Coste
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-09-01Make Token a simple aggregateMaxime Coste
2017-08-29Rename containers.hh to ranges.hh (and Container to Range)Maxime Coste
2017-06-29Remove some dead codeMaxime Coste
2017-06-17src: Add a `commands` debug flagFrank LENORMAND
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-07Remove unneeded unknown_expand exception typeMaxime Coste
2017-06-07Do not allow whitespaces as % string delimitersMaxime Coste
2017-06-04Improve readability of command docstrings by changing formattingMaxime Coste
Fixes #1378
2017-05-25Fix command parsing bug when commenting after a commandMaxime Coste
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-08Do not push a final spurious command separators when parsing commandsMaxime Coste
Fixes #1336
2017-05-07Fix use of invalidated iterator in the command map on exceptionMaxime Coste
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-04-19Safer code for parsing commandsMaxime Coste
Fix some possible past the end of target string reads Fixes #1310 (maybe, probably, who knows)
2017-04-10Remove some now unneeded uses of const String& paramsMaxime Coste
HashMap supports finding String from StringView.
2017-03-16Fixes some clang-tidy warning and add a few missing meta.hh includeMaxime Coste
2017-03-15Small code tweaks regarding flags handlingMaxime Coste
2017-03-07Replace uses of UnorderedMap with HashMapMaxime Coste
2017-01-29Detect too deep command call stackMaxime Coste
Fixes #1163
2017-01-29Make StringView and unit types trivial typesMaxime Coste
2017-01-08Small code cleanupsMaxime Coste
2017-01-08Apply clang-tidy modernize to the codebaseMaxime Coste
2016-12-27Merge remote-tracking branch 'leira/empty_param_crash'Maxime Coste
2016-12-24Added string length check when checking switch paramsLeira Hua
Fixes #1051
2016-12-23Display the command prompt in error face when the command is not foundMaxime Coste
Fixes #1021
2016-12-07Ensure content of expanded strings in modelinefmt is not interpreted as markupMaxime Coste
2016-12-07Small command parsing refactoringMaxime Coste
2016-11-20Make ArrayView::subrange size arguement optionalMaxime Coste