Commit Graph

623 Commits

Author SHA1 Message Date
John Colvin
94a3b85745 Missing space at eol in write CommandDesc 2018-08-28 11:59:43 +01:00
Frank LENORMAND
1da0af26c9 src: Make sure buffers are saved regardless of the client count
Due to a copy-paste mistake, the `:kill` command in a session with
multiple clients was the equivalent of a force-kill (`:kill!`).

This commit makes sure all buffers are saved before killing the
session, unless the force flag is specified.
2018-08-21 17:27:17 +03:00
Maxime Coste
293610a432 Add a test case for -once hooks and code style tweaks 2018-08-16 21:09:51 +10:00
Maxime Coste
4387b1ac90 Merge remote-tracking branch 'lenormf/fix-hook-once' 2018-08-16 18:46:26 +10:00
Frank LENORMAND
97abfd403d src: Forbid empty menu entries
Empty entries in menus look weird, and don't serve any purpose. Empty
commands are still allowed.
2018-08-11 10:03:57 +03:00
Frank LENORMAND
e84dcf72c0 src: Allow hooks to be run only once
This commit implements the -once flag on the `:hook` command, which
automatically removes a hook after it was run, to avoid having to
declare a group and remove it in the hook implementation.

Closes #2277
2018-08-06 15:14:20 +03:00
Maxime Coste
d2509e54f2 Fix compilation with gcc-5
Gcc-5 seems to have a bug in its handling of template variable.

Fixes #2267
2018-07-30 07:15:17 +01:00
Maxime Coste
2c9daf2378 Merge remote-tracking branch 'Delapouite/map-key-completer' 2018-07-28 19:48:24 +10:00
Maxime Coste
bbb508634e Support setting registers to empty lists
Note that empty registers still act as-if they contained a single
empty string.

Fixes #2228
2018-07-23 08:35:13 +10:00
Maxime Coste
7195100609 Re-introduce kill_session::exit_status, @lenormf was right
As discussed in #2186, in the end we need the exit status for the
case where the local client exited first (the server forked to
background) then another client trigger the kill command.
2018-07-19 19:27:56 +10:00
Maxime Coste
56a5dc66ff Merge remote-tracking branch 'lenormf/kill-clients-exit-code' 2018-07-19 18:42:22 +10:00
Frank LENORMAND
5543a4d58c src: Propagate to clients the kill exit code
Fixes #2177
2018-07-19 10:54:49 +03:00
Maxime Coste
56912dd22c Merge remote-tracking branch 'icetan/buffer-reload-hook' 2018-07-19 08:29:22 +10:00
Maxime Coste
b1d5fda960 Reduce confusion in add-highlighter docstring
Closes #2222
2018-07-19 08:26:25 +10:00
Maxime Coste
2f815511da Merge remote-tracking branch 'Screwtapello/fix-info-docstring' 2018-07-14 23:17:10 +10:00
Tim Allen
591a9ab093 The info command only takes one content string, not one-or-more. 2018-07-10 17:51:57 +10:00
Christopher Fredén
ae6c214f52
Add BufReload hook which is triggered on buffer reload 2018-07-09 14:20:52 +02:00
Maxime Coste
51ec1194f1 Use a memory mapped file for sourcing 2018-07-08 17:25:12 +10:00
Maxime Coste
f89ea657ef Fix asserts with -sync flag handling and slight code cleanup 2018-07-05 08:30:57 +10:00
Maxime Coste
55a5ec3bbd Tweak how highlighter names are auto-generated 2018-07-05 07:54:28 +10:00
Maxime Coste
f9fda70de6 Fix add-highlighter docstring 2018-07-05 07:54:28 +10:00
Maxime Coste
073b630e7a Prevent adding region/default-region highlighters to non-regions parents 2018-07-05 07:54:28 +10:00
Maxime Coste
64d0fd91ae Auto-generate highlighter name if only path is given 2018-07-05 07:54:28 +10:00
Maxime Coste
b4b335155e Refactor add-highlighter to make naming explicit
The highlighter name must be given as part of the path of the
highlighter, as the last element.

Fixes #1712
2018-07-05 07:54:28 +10:00
Maxime Coste
8aba0b3cb4 Change set-register command to take a list of values
Registers are lists of strings, so this make it possible to set
the whole list instead of forcing registers to a single element
when going through the set-register command.
2018-07-05 07:54:28 +10:00
Maxime Coste
8b2e5ea862 Make selection lists use the option list syntax 2018-07-05 07:54:28 +10:00
Maxime Coste
b548dd3a6f Change option lists to be specified as separate arguments on commands line
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-05 07:54:28 +10:00
Maxime Coste
24d8a58b0d Add -with-hooks to execute-keys and make -no-hooks evaluate-commands specific 2018-07-05 07:54:28 +10:00
Maxime Coste
9082564ab7 Make -with-maps only available for execute-keys command
It does not make a lot of sense to have this switch for
evaluate-commands.
2018-07-05 07:54:28 +10:00
Maxime Coste
5902c7b790 Do not save any registers by default in evaluate-commands 2018-07-05 07:54:28 +10:00
Maxime Coste
ec16969609 Do not reparse %sh{...} strings
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-07-05 07:54:28 +10:00
Maxime Coste
3b9818c10b Merge remote-tracking branch 'lenormf/edit-readonly-flag' 2018-07-04 19:47:05 +10:00
Frank LENORMAND
5309b7b5e5 src: Add a -sync flag to the write commands 2018-07-04 09:49:53 +03:00
Frank LENORMAND
dd17b20bbf src: Allow the edit command to create readonly buffers 2018-07-03 14:34:48 +03:00
Delapouite
0bfdaf7d3e Improve unmap command key-completer 2018-06-15 15:16:08 +02:00
Maxime Coste
665d3fa196 Fix edit -fifo without -scroll when the buffer is already opened
Scrolling was taking place in that case even though it was not
desired.
2018-06-13 07:11:03 +10:00
Maxime Coste
68fb3ba88f Rework fail command not to display command call stack
`fail` triggers "expected" errors, and hence should just display
the provided message.
2018-05-26 21:31:17 +10:00
Maxime Coste
9b89652b0b Fix potential assert on itersel selection restoration
We cannot guarantee after an itersel that selections are going to
still be in ascending order, but we were calling a SelectionList
constructor that was assuming this was the case.
2018-05-24 08:08:51 +10:00
Maxime Coste
ec0f8fe574 Extend try command to support multiple catches.
If a catch command fails, and another catch is availabe following
it, that following catch gets executed.
2018-05-19 14:15:16 +10:00
Maxime Coste
14d12fac04 Rename -allow-override switch to -override
Closes #2057
2018-05-19 14:15:16 +10:00
Maxime Coste
75eb293f98 Rename Context::Flags::Transient to Context::Flags::Draft
Draft is well establish and all draft context are transient.
2018-05-14 08:23:00 +10:00
Maxime Coste
b204e773d4 Do not push jumps implicitely in transient contexts
This should improve performance in draft contexts.
2018-05-14 08:23:00 +10:00
Maxime Coste
da1d78a3c2 Do not let exception propagate out of register restoring lambda
It is called during a std::vector destruction, which is noexcept,
leading to terminate being called.
2018-05-05 07:57:37 +10:00
Maxime Coste
a19ce37634 Tweak the way register restorers are created to try to fix OSX compilation 2018-05-03 08:14:15 +10:00
Maxime Coste
4288f0fb3a Move ScopedEdition to context_wrap
No need to create it both in context_wrap and in the called function.
2018-05-01 22:49:01 +10:00
Maxime Coste
286a244aa2 Replace RegisterRestorer with a on_scope_end + lambda 2018-05-01 22:48:14 +10:00
Maxime Coste
8438b33175 Add a debug regex command to dump regex instructions 2018-04-27 08:35:09 +10:00
Maxime Coste
4eb6740794 Add a -always switch to hook command to ignore hooks disabled
Hooks specified as always will run regardless of the hook disabled
status.
2018-04-26 08:28:11 +10:00
Maxime Coste
e207bd30d4 Extract a for_n_best algorithm from completion function
Provide the heap based n-best algorithm through a nice interface.
2018-04-19 07:58:42 +10:00
Maxime Coste
d571c207e6 Make version available through $kak_version and debug info 2018-04-09 17:06:02 +10:00