summaryrefslogtreecommitdiff
path: root/src/command_manager.cc
AgeCommit message (Collapse)Author
2020-03-13Handle invalid utf8 in command line a bit betterMaxime Coste
Reduce the amount of decoding by working directly on bytes. Fixes #3388
2020-03-12src: Don't escape completion candidates with `\`Frank LENORMAND
Completion candidates are currently escaped with a backslash `\` character, which leads to ugly interactive commands on the prompt, especially when they contain space characters. This commit makes completion candidates be escaped by simple quoting. Examples: candidate\ with\ spaces \%opt{foo} \"dquote \'quote become: 'candidate with spaces' '%opt{foo}' '"dquote' '''quote'
2020-03-02Expand env vars as list of stringsMaxime Coste
This makes it possible to do :select `%val{selections_decs}` and to correctly combine $kak_quoted with those.
2019-12-24Fix command error line/column reportingMaxime Coste
2019-11-26Merge remote-tracking branch 'lenormf/complete-expansion-reg'Maxime Coste
2019-11-23src: Complete filenames in `%file{}` expansionsFrank LENORMAND
2019-11-23src: Complete register names in `%reg{}` expansionsFrank LENORMAND
Builtin registers have name aliases that can be completed upon when using a `%reg{}` expansion from the prompt.
2019-11-09Add static or const where usefulJason Felice
2019-09-01Introduce FunctionRef to replace std::function when not storingMaxime Coste
std::function is not necessary when we just want to pass a type erased callback that does not need to own its target. FunctionRef provides that functionality for a much lower compile time cost.
2019-06-25Rename ModuleLoad hook to ModuleLoadedcodesoap
This clarifies, that the hook is run *after* the module is loaded.
2019-06-19Refactor option_to_string quoting support, introduce Quoting::RawMaxime Coste
2019-05-17Introduce Menu completion flags to auto select best candidateMaxime Coste
2019-05-13Add completion support to load-moduleMaxime Coste
2019-04-08Evaluate modules in an empty contextJustin Frank
2019-04-08Added ModuleLoad hook that uses the module name as the parameterJustin Frank
2019-04-08Added 'provide-module' and 'require-module' commandsJustin Frank
2019-04-07Add support for %file{...} expansionsMaxime Coste
This should make the use case exposed in #2836 implementable.
2019-03-19Make String able to reference external data without copyingMaxime Coste
Sometimes we really need to have a String instead of a StringView, but some of those strings might not need to own their data. Make it possible to explicitely construct a String that does not own the underlying buffer. Use it when parsing balanced strings.
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