Commit Graph

5274 Commits

Author SHA1 Message Date
Johannes Altmanninger
08509cb408 Refactor: use is_eol() as elsewhere in this function 2020-05-17 14:11:45 +02:00
Maxime Coste
5fd548d5cf Fix use of unportable MSG_CMSG_CLOEXEC 2020-05-17 21:28:40 +10:00
Maxime Coste
151eb3299d Fix CSI u parsing of some special keys 2020-05-12 08:50:27 +10:00
Maxime Coste
60154300f9 Support piping data to client stdin
Pass the client stdin fd to the server and open a fifo buffer
from it.

Fixes #3394
2020-05-10 19:30:13 +10:00
Maxime Coste
2104af0771 Fix select_sentence going past the end of the buffer
Fixes #3472
2020-05-10 15:13:15 +10:00
Maxime Coste
f4efde7e08 Merge remote-tracking branch 'krobelus/kak-c-initial-buffer-pos' 2020-05-03 13:20:44 +10:00
Maxime Coste
2fca4e5643 Fix traling whitespaces 2020-05-02 13:02:10 +10:00
Maxime Coste
ccecd5bd8e Add support for alpha channel in colors
This makes it easier to define faces that lighten/darken whatever
they apply on.
2020-05-02 12:57:36 +10:00
Johannes Altmanninger
c010f14a7c Fix +line:col initial buffer position when connecting to session
A command line argument like +line[:column] can be used to specify a
target line and column for the first file.

This did not work when connecting to a session, because the client
opens its file parameter with `-e "edit file1; edit file2"` which is
executed after the initial buffer position is set. Work around this by
passing the position to the first file and avoid moving the cursor
in unrelated files.

Reproduce:

	kak -s foo
	kak -c foo +4:11 README.asciidoc
2020-05-01 10:05:37 +02:00
Maxime Coste
ceff2286af Fix clang compilation 2020-04-27 17:41:09 +10:00
Maxime Coste
35e8e12b12 Merge branch 'netbsd-1' of https://github.com/krytarowski/kakoune 2020-04-27 17:40:33 +10:00
Maxime Coste
954373d3cf Support multi-line replace-ranges
This likely has lots of rough edges, but should be an initial proof
of concept to support folding.
2020-04-27 17:39:21 +10:00
Maxime Coste
cb119251bc Do not replace partially selected ranges in replace-ranges highlighter
Partially selected ranges should not be replaced to make it possible
to see what is actually selected.
2020-04-27 17:39:21 +10:00
Maxime Coste
0fdfbdfd15 Fix highlighting empty ranges at end of line and begin of line 2020-04-27 14:31:26 +10:00
Maxime Coste
fde4c60dd9 Factor option based highlighters 2020-04-27 14:31:26 +10:00
Kamil Rytarowski
22931bdc1f Fix get_kak_binary_path() for NetBSD
Pass correct mib[] to sysctl(3).
2020-04-23 03:24:24 +02:00
Maxime Coste
a33b938652 Fix issue with select object and empty matches 2020-04-21 13:21:35 +10:00
Maxime Coste
562ee6143a Parse ascii newline/tab/escape as special keys instead of control keys
Fixes #3439
2020-04-13 12:44:15 +10:00
Maxime Coste
8000cd092f Fix internal command naming 2020-04-13 12:24:45 +10:00
Maxime Coste
91e3a58a3a Merge remote-tracking branch 'lenormf/fix-3410' 2020-04-13 11:09:08 +10:00
Maxime Coste
0fb479f0c2 Merge branch 'netbsd' of http://github.com/niacat/kakoune 2020-04-09 07:42:53 +10:00
Maxime Coste
f7a2ecfacb Support empty ranges in replace-ranges highlighter 2020-04-06 11:23:47 +10:00
Maxime Coste
c585107ab5 Add -override support to add-highlighter
This allow replacing a highlighter in place, not loosing its current
position in its parent.

Fixes #3436
2020-03-30 21:04:01 +11:00
Maxime Coste
b42885ef71 Fix empty strings not being zero terminated 2020-03-29 20:28:56 +11:00
Maxime Coste
8f30e37507 Untie focus reporting and mouse handling 2020-03-27 07:54:21 +11:00
nia
7d4a83a449 || -> or for consistency 2020-03-22 11:00:27 +00:00
nia
28982aae92 Fix build on NetBSD 2020-03-22 10:49:06 +00:00
Maxime Coste
3c265acd6c Remove posB from information given by the diff algorithm
posB is always the sum of previous add len and previous keep len,
so very easy to keep track of.
2020-03-20 20:27:50 +11:00
Maxime Coste
401ef84a4b Remove uses of reverse_iterator in diff implementation 2020-03-20 20:24:42 +11:00
Frank LENORMAND
07d702e419 src: Fix a compilation bug with g++-8
The Ubuntu Disco distribution comes with `g++` v8 installed by default,
which is not able to deduce the return type of a particular call to
`transform()`.

This commit explicitly declares the return type to mitigate that
problem, and allow the file to compile.

Fixes #3410
2020-03-17 09:00:29 +03:00
Maxime Coste
1b28a19058 Merge remote-tracking branch 'Anfid/scroll-test' 2020-03-15 12:32:54 +11:00
Maxime Coste
09375edf54 Merge remote-tracking branch 'occivink/arrange-buffers' 2020-03-15 12:18:04 +11:00
Maxime Coste
7545fa58ae Fix invalid access to deleted line when updating insert completion
The computation of the completion end position was taking place too
early, before we checked if the buffer did get modified.

Fixes #3349
2020-03-14 13:49:52 +11:00
Maxime Coste
31caae20eb Allow reading from fifo in readonly buffers
readonly is supposed to prevent the user from modifying the buffer
and it can be useful to generate a readonly fifo buffer.

Fixes #3398
2020-03-14 12:58:22 +11:00
Maxime Coste
8c2ef4965a Merge remote-tracking branch 'lenormf/fix-completion-escaping' 2020-03-13 08:08:17 +11:00
Maxime Coste
83a17227a5 Merge remote-tracking branch 'lenormf/fix-Makefile-compiler-string' 2020-03-13 08:06:42 +11:00
Maxime Coste
a53d501f7b Merge remote-tracking branch 'lenormf/fix-3399' 2020-03-13 08:05:04 +11:00
Maxime Coste
149da2064d Handle invalid utf8 in command line a bit better
Reduce the amount of decoding by working directly on
bytes.

Fixes #3388
2020-03-13 08:02:58 +11:00
Frank LENORMAND
7b28e68d6c src: Don't escape completion candidates with \
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-12 22:24:44 +03:00
Frank LENORMAND
789caf89a3 rc Makefile: Fix the predicate to detect g++
Some distributions replace the expected "GCC" tag with their own name
and version, causing the Makefile not to include a compiler flag.
2020-03-12 17:04:34 +03:00
Joachim Henke
3881dc1e7a restore F1 key handling 2020-03-04 09:06:46 +01:00
Maxime Coste
610be9ac20 Fix invalid memory access in unit-tests 2020-03-04 12:08:16 +11:00
Maxime Coste
e3a5856284 Only replace chars >= 0 in fix_atom_text
If char is signed, the test was invalid

Fixes #3389
2020-03-03 20:16:31 +11:00
Maxime Coste
7a9292be58 Merge remote-tracking branch '6112/clippy-delay' 2020-03-03 07:49:02 +11:00
Maxime Coste
0a66eb9c47 Expand env vars as list of strings
This makes it possible to do :select `%val{selections_decs}` and to
correctly combine $kak_quoted with those.
2020-03-02 20:53:28 +11:00
Nicolas Ouellet-Payeur
10d887583f Make on_next_key_with_autoinfo() respect idle_timeout
The prompt and autocomplete normally wait for `idle_timeout` before showing
suggestions, however commands like `g`, `v`, or the lead-key show Clippy
instantly.

This fixes the issue by making `on_next_key_with_autoinfo()` wait for
`idle_timeout` before displaying suggestions.

Fixes mawww/kakoune#3365
Fixes mawww/kakoune#2066
2020-02-27 10:36:15 -05:00
Maxime Coste
b8eef27e04 Enable terminal application keypad mode 2020-02-26 17:45:52 +11:00
Maxime Coste
af6885c0c9 Control character end at 0x1F 2020-02-26 07:59:05 +11:00
Maxime Coste
df844c6243 Do not replace spaces in prompt text 2020-02-25 20:09:25 +11:00
Olivier Perret
5c116ab850 Add a new 'arrange-buffers' to let users change the order of the buflist 2020-02-24 09:41:46 +01:00
Maxime Coste
93a889bd44 Merge remote-tracking branch 'lenormf/complete-register-names' 2020-02-22 08:39:35 +11:00
Maxime Coste
bc8a9d82c3 Use Control Picture codepoints in prompt for all codepoints < 0x22
Fixes #3333
2020-02-22 08:39:21 +11:00
Maxime Coste
3ef8a6160d Small code style tweak in ranges.hh 2020-02-18 19:28:41 +11:00
Maxime Coste
60782b3dc9 Make diff implementation able to work on different iterator types 2020-02-18 19:26:01 +11:00
Maxime Coste
16e814d99e Merge remote-tracking branch 'lenormf/fix-makefile' 2020-02-16 10:40:45 +11:00
Maxime Coste
4438895cd5 Merge remote-tracking branch 'lenormf/startup_info-no_kakrc' 2020-02-16 10:40:12 +11:00
Maxime Coste
df4f71aaed Merge remote-tracking branch 'lenormf/fix-write-switches' 2020-02-15 18:34:18 +11:00
Maxime Coste
940b1b6175 Fix invalid memory access when getting the main entry of empty registers
Fixes #3370
2020-02-15 15:42:08 +11:00
Frank LENORMAND
744336ef2b src: Only remove objects and dependencies for the current target 2020-02-09 19:12:40 +01:00
Frank LENORMAND
e06d61a3e0 src: Allow :write-all to use -atomic, fix usage
It seems that when -atomic was implemented for `:write`, the usage
strings were not updated to reflect that a new flag was available.

The `write-all` command didn't benefit from the implementation of
the new flag despite also writing files - this commit fixes that.
2020-02-09 17:07:47 +01:00
Frank LENORMAND
c0cb5db6a4 src: Let :set-register complete register names
This commit allows the `set-register` command to suggest candidates
named after punctuated registers, similarly to %reg{…} expansions.
2020-02-09 15:31:08 +01:00
Frank LENORMAND
7790e31eb8 src: Don't show startup information when opening a file
Follow-up to #3317
2020-02-07 12:27:54 +01:00
Maxime Coste
e9cf0f23f2 Fix regex start desc computation for case insensitive ranges
Fixes #3345
2020-02-07 07:37:29 +11:00
Maxime Coste
fbd75d91ec Merge remote-tracking branch 'maximbaz/notes-formatting' 2020-02-07 07:02:32 +11:00
Maxime Coste
8b633aa79a Merge remote-tracking branch 'jo-he/master' 2020-02-07 07:01:17 +11:00
Maxime Coste
a105111593 Merge remote-tracking branch 'lenormf/startup_info-no_kakrc' 2020-02-07 07:00:25 +11:00
Frank LENORMAND
1ebab6c269 src: Show the startup information in no-load mode
This commit allows the changelog to be shown at startup even when
the editor was run with the -n flag.
2020-02-05 11:39:23 +01:00
Maxime Coste
e348219fee Merge remote-tracking branch 'omasanori/startup_info_version' 2020-02-05 20:51:17 +11:00
geppettodivacin
39a2ab84fa Use ReverseView to perform fewer allocations
The first attempt at a bug fix for @ symbols in selection buffer names
worked, but it was very inefficient. In particular, it allocated three
different vectors, and we really only needed the correct elements.
Manipulating iterators to give us the right slices of the existing
vector is far more efficient.

By reversing the original content and taking the last two, we're able to
get the number of selections and main selection without too much hassle.
The buffer name is everything from the start of the content to the
selection count. This gets us through with only one vector allocation.

Credit to @mawww for the optimization idea and for fixing my types.
2020-02-02 22:12:18 -06:00
geppettodivacin
5596b4b2b9 Add support for @ symbols in selection buffer
The selection descriptions use the format
`<buffer>@<timestamp>@<main_index>`. This fails when file paths have `@`
symbols in them: the parser splits on `@` symbols and finds more values
than it expects.

We here modify the behavior to require *at least* two @ symbols, using
the last two for `<timestamp>` and `<main_index>` and leaving the
remaining text for the <buffer>. This should work for any number of `@`
symbols, since `<timestamp>` and `<main_index>` are numbers and should
never contain `@` symbols.
2020-01-26 16:03:03 -06:00
Masanori Ogino
144380de8c Fix version comparison in show_startup_info.
The description of startup_info_version in the manual says "only messages
relating to a Kakoune version greater than this value will be displayed,"
but showed messages relating to the version equal to that value.

This change aligns the code with the manual and makes a workaround that set
startup_info_version next to the original version (ex. 20200117) unnecessary.

Signed-off-by: Masanori Ogino <masanori.ogino@gmail.com>
2020-01-21 14:51:18 +09:00
Joachim Henke
4914029712 fix several control key combinations in st 2020-01-20 12:51:06 +01:00
Maxim Baz
8f350ad5a9
Bring the italic formatting back 2020-01-20 09:46:11 +01:00
Joachim Henke
2deeb9df52 make the Insert key work in st 2020-01-19 16:22:34 +01:00
Maxim Baz
4dce836c5a
Fix version notes formatting 2020-01-16 13:23:13 +01:00
Maxime Coste
9ca479ed40 Kakoune v2020.10.16 2020-01-16 20:52:20 +11:00
Maxime Coste
b85365bff8 Reset SIGHUP handler on NCursesUI destruction
SIGHUP handler could trigger crashes if the EventManager was
already destructed when it was triggered.

Fixes #3288
2020-01-11 17:22:33 +11:00
Maxime Coste
6badd74790 Fix compilation on 32bit platforms
Fixes #3284
2020-01-09 20:13:02 +11:00
Maxime Coste
f808539dea Update inserted range when generating InsertCompletionHide hook param
The buffer might have been mutated in the mean time.

Fixes #3270
2020-01-08 20:33:26 +11:00
Maxime Coste
b37638dda4 Split RegexHighlighters matches per requested buffer ranges
When a region calls the regex highlighter, it is incorrect to share
the regex cache as it means we can get matches that span multiple
regions.

Fixes #3041
2020-01-05 18:58:32 +11:00
Maxime Coste
80ffc4d34f Merge remote-tracking branch 'fsub/rxvt' 2020-01-05 10:03:37 +11:00
Maxime Coste
b6f4985c10 Use markup for startup-info message 2020-01-04 12:12:38 +11:00
Maxime Coste
e6b98744c6 Restore support for line wrapping info boxes
Fixes #3280
2020-01-04 11:41:16 +11:00
Maxime Coste
8b6ed26e8c Few style changes on history exposition code 2020-01-02 22:36:26 +11:00
Maxime Coste
43dc494e5c Merge remote-tracking branch 'eraserhd/history-api' 2020-01-02 21:13:43 +11:00
Jason Felice
b03b51d27a Add 'history' and 'uncommitted_modifications' expansions 2020-01-01 19:47:29 -05:00
Maxime Coste
a17a0345cf Fix replacing at begining of buffer
Fixes #3275
2019-12-31 12:49:24 +11:00
Maxime Coste
22bfbd06af Redraw relevant clients after adding/removing highlighters 2019-12-28 11:27:04 +11:00
Maxime Coste
7c1d4f5bd6 Avoid unnecessary std::function 2019-12-28 10:47:16 +11:00
Maxime Coste
456fbd1315 Refactor fifo buffer reader code 2019-12-28 10:32:15 +11:00
Maxime Coste
62b4780e07 Fix command error line/column reporting 2019-12-24 08:34:24 +11:00
Maxime Coste
1946b6b09c Merge remote-tracking branch 'jkonecny/master-backport-fedora-spec' 2019-12-19 13:45:27 +11:00
Maxime Coste
a3445232a4 Update fs status post buffer write 2019-12-19 13:39:30 +11:00
Jiri Konecny
e6c7a8e44f
Make possible to change compression for make dist
This will make possible to get the same archive from make dist as from
GitHub archives. GitHub archives do not support current bzip2.
2019-12-18 17:59:18 +01:00
Maxime Coste
b68490ef11 Cleanup replaced range selection logic
Do not access Buffer::m_changes to find the inserted range, return
it directly from Buffer::insert and Buffer::replace. This fixes a
wrong behaviour where replacing at eof would lose the selected end
of line (as the implementation does not actually replace that end
of line)
2019-12-18 11:36:17 +11:00
Maxime Coste
878a7fbb90 Fix window_range expansion
It relied on the buffer first char being visible, and could trigger
segfaults when that was not the case.
2019-12-16 14:09:20 +11:00
Maxime Coste
efabe28173 Fix WinResize hook getting triggered during urgent event processing
WinResize hooks could be triggered during shell evaluation, leading
to any state potentially getting mutated after a shell evaluation
call.
2019-12-16 14:07:22 +11:00
Tim Allen
b09653ccc5 highlighters.cc: Add a '-min-digits' flag to the number-lines highlighter.
Fixes #3260.
2019-12-15 13:36:25 +11:00
Maxime Coste
dfc67dd582 Code style tweak 2019-12-15 10:47:20 +11:00
fsub
e7e7289813 Support rxvt style s-F3 to s-F10 2019-12-14 23:17:34 +01:00
fsub
3aab032797 Support rxvt style s-F11 and s-F12
Rxvt emits `\E[23$` and `\E[24$` for `F21` and `F22` (alias `s-F11` and
`s-F12` provided that `ncurses_shift_function_key` is set to `10`),
respectively.
2019-12-14 20:03:48 +01:00
Maxime Coste
874717885a Code style tweak in insert_output 2019-12-14 09:20:01 +11:00
Maxime Coste
32157a5809 Merge remote-tracking branch 'lenormf/reevaluate-exclamation-point' 2019-12-14 09:13:43 +11:00
Maxime Coste
53cef671fc Merge remote-tracking branch 'Screwtapello/tmux-keys' 2019-12-12 12:02:51 +11:00
Tim Allen
170762b4d9 src/ncurses_ui.cc: Add support for VT220-style Home and End keys.
Because we now support a bunch of different conventions for these keys, let's
add some citations for the benefit of future maintainers.

Fixes #3252.
2019-12-11 22:53:15 +11:00
Tobias Kortkamp
fc2b5c5f7b
Fix build on FreeBSD again
json_ui.cc:29:9: error: use of undeclared identifier 'sprintf'
        sprintf(buffer, R"("#%02x%02x%02x")", color.r, color.g, color.b);
        ^
1 error generated.

Regressed by 7cdbe1d3d2
2019-12-10 18:13:08 +01:00
Maxime Coste
9ace7b584d Kakoune v2019.12.10 2019-12-10 21:36:03 +11:00
Maxime Coste
15df0fc781 Add -scratch and -file switches to the rename-buffer command 2019-12-07 15:40:57 +11:00
Maxime Coste
42094209fd Update New flag and last save timestamp on buffer rename
Fxies #3244
2019-12-07 15:40:55 +11:00
Maxime Coste
023a65eeac Optimize regex in command 2019-12-05 21:11:12 +11:00
Maxime Coste
eb5af59d55 Restore regex optimization pass by introducing basic block analysis
Run the peephole optimizer on each basic block, avoiding the
previous issue that some instructions could move across their
boundaries.
2019-12-05 21:10:14 +11:00
Maxime Coste
d539e8fb89 Do not decode utf-8 when looking for regex next start
There is no need to decode as we know any non-ascii characters will
be treated as Other in the StartDesc.
2019-12-04 22:33:11 +11:00
Maxime Coste
ee2985739b Merge remote-tracking branch 'lenormf/window-range' 2019-12-04 21:16:11 +11:00
Maxime Coste
5c5d881c11 Merge remote-tracking branch 'lenormf/reload-buffer-hash' 2019-12-04 21:14:15 +11:00
Frank LENORMAND
e1bd076f5e src: Reload buffers when their contents' hash changes
Instead of triggering a reload event when the timestamp of a buffer's
underlying file changes, do so when its contents are actually modified.
2019-12-03 17:05:24 +01:00
Maxime Coste
0b66aa8dda Document that fg face is optional 2019-12-03 21:17:33 +11:00
Maxime Coste
36dce6a2d0 Merge remote-tracking branch 'lenormf/split-json' 2019-12-03 21:13:35 +11:00
Maxime Coste
5c1433ee65 Merge remote-tracking branch 'Laaas/patch-1' 2019-12-03 21:11:14 +11:00
Maxime Coste
b5baac4336 Merge remote-tracking branch 'lenormf/fix-doc-face-base' 2019-12-03 20:59:40 +11:00
Maxime Coste
a6a5d866a5 Merge remote-tracking branch 'somasis/master' 2019-12-03 20:59:33 +11:00
Frank LENORMAND
d32a660863 src: Document the base face syntax in :set-face 2019-12-02 11:37:31 +01:00
Frank LENORMAND
63092d12c0 src: Fix the build on Mac
When compiled on Mac with `clang`, the following error occurs at
compile-time:

```
./diff.hh:56:28: error: no member named 'min' in namespace 'std'
    const int max_D = std::min((M + N + 1) / 2 + 1, cost_limit);
                      ~~~~~^
```
2019-12-01 21:55:55 +01:00
Maxime Coste
2623366514 Pass inserted text ranges in InsertCompletionHide hook parameter
Fixes #2898
2019-12-01 21:05:02 +11:00
Kylie McClain
dc1cf24846
buffer.hh: Fix building on musl+libc++
Fixes #3233.
2019-11-29 22:58:36 -05:00
Maxime Coste
4fdbf21ff8 Refactor diff to make allocating a diff vector optional
The diff interface now goes through a for_each_diff function that
uses a callback for each found diff.
2019-11-30 11:29:36 +11:00
Mikhail Pogretskiy
89b4996fd7 Update scroll behavior 2019-11-28 22:35:52 +07:00
Maxime Coste
b765fb4971 Merge remote-tracking branch 'lenormf/fix-mmap-size-check' 2019-11-28 20:35:52 +11:00
Maxime Coste
085e7dd09e Merge remote-tracking branch 'lenormf/patch-2' 2019-11-28 20:32:16 +11:00
Maxime Coste
2904d13420 Add a {\} marker to disable markup processing 2019-11-28 20:23:52 +11:00
Frank LENORMAND
7a384edeb0 src: Check the filesize before calling mmap() 2019-11-26 13:26:31 +01:00
Maxime Coste
fc9e0e8c6a Fix small info text not being displayed 2019-11-26 22:08:05 +11:00
Maxime Coste
a933cae7b9 Merge remote-tracking branch 'lenormf/complete-expansion-reg' 2019-11-26 21:35:05 +11:00
Maxime Coste
9716c7c82d Merge remote-tracking branch 'lenormf/complete-expansion-file' 2019-11-26 21:34:22 +11:00
Frank LENORMAND
7512f5eae6 src: Use begin() to get iterators
When compiling the code with `-Wp,-D_GLIBCXX_ASSERTIONS`, the process
gets aborted, likely because iterators to standard containers are
not obtained in a safe way.

Fixes #3226.
2019-11-25 11:34:39 +01:00
Maxime Coste
6f087e899b Complete rename-buffer with filenames
Fixes #3215
2019-11-24 18:11:29 +11:00
Maxime Coste
6fd486c65e Replace tab characters with spaces in info/echo
This is tricky to fix better than that as tabs make text length
dependent on where it will get displayed and what preceedes it.

Also fix an issue with empty info title

Fixes #2237
2019-11-24 18:11:29 +11:00
Maxime Coste
34f48cc851 Rework ncurses info display, crop content when overlflowing
Optmize the code to avoid allocating like crazy, unify various
info style rendering, crop content and display markers that there
is more text remaining.

Fixes #2257
2019-11-24 18:11:29 +11:00
Maxime Coste
19e1be8e0d Make wrap_lines a lazy range view
Avoid the need to allocate a vector by using the ranges
framework.
2019-11-23 21:50:58 +11:00
Frank LENORMAND
ae85753c41 src: Complete filenames in %file{} expansions 2019-11-23 08:59:44 +01:00
Frank LENORMAND
2cdf86d674 src: Complete register names in %reg{} expansions
Builtin registers have name aliases that can be completed upon when
using a `%reg{}` expansion from the prompt.
2019-11-23 08:47:14 +01:00
Maxime Coste
cb1b03c0db Add support for markup in info boxes
Fixes #2552
2019-11-22 21:50:51 +11:00
Maxime Coste
22d9ffa63a Fix crash when deleting buffers in a BufClose hook 2019-11-22 20:29:55 +11:00
Maxime Coste
82e5346904 Add a -atomic switch to write and change clang.kak to take advantage 2019-11-21 23:38:32 +11:00
Frank LENORMAND
15f6485327
src: Give a reason why :rename-buffer failed 2019-11-18 16:46:53 +00:00
Maxime Coste
c031a276d5 Fix recently introduced ncurses redraw artifact 2019-11-18 21:17:22 +11:00
Maxime Coste
ba621dedd6 Ignore SIGTTOU
We can get this signal while suspending if a parent process (say
git-commit) has already put us in the background. We still need
to reset the termios state to exit raw input mode and make the shell
usable.

Fixes #3069
2019-11-18 21:00:59 +11:00
Maxime Coste
d3c3e59bbf Fix search menu trimmed entry display 2019-11-17 22:53:27 +11:00
Maxime Coste
1de038a743 Move the forked server into a new session and process group
Fixes #3212
2019-11-17 22:44:49 +11:00
Frank LENORMAND
19f1754a2a src json: Limit the recursion depth to 100 2019-11-17 09:27:46 +01:00
Frank LENORMAND
7cdbe1d3d2 src: Move JSON parsing code to its own file
The `json_ui.cc` file contained both data-parsing and UI-related
code. This commit moves the JSON parsing code to its own `json.cc`
file, to separate concerns, make compilation faster when changes are
made to either UI or parsing code, and make the parsing code more
accessible to fuzzers.

The signature of the following function:

```
auto parse_json(StringView json);
```

was changed to:

```
JsonResult parse_json(StringView json);
```

to avoid `auto` deduction issues at compile-time.
2019-11-17 09:27:46 +01:00
Maxime Coste
5378dabdec Fix String::resize not zero-terminating 2019-11-17 09:50:18 +11:00
Maxime Coste
e33ba455c8 Re-merge clear_to_eol in draw 2019-11-13 22:17:08 +11:00
Jason Felice
0f58f01428 Fix display column computations
Closes #3201
2019-11-12 20:43:14 -05:00
Maxime Coste
a7d3976a10 Fix typo 2019-11-13 08:58:15 +11:00
Maxime Coste
e964b68ab8 Add support for selecting and exporting selections in display columns
Fixes #2724
2019-11-12 21:56:45 +11:00
Maxime Coste
7a8f57f97b Add support for a -codepoint switch to the select command 2019-11-12 21:21:24 +11:00
Jason Felice
5fae16faef Implement %val{selections_char_desc}
Fixes #3194
2019-11-12 20:54:32 +11:00
Maxime Coste
6eb820dc54 Fix use after free in enter_user_mode, use user.<name> for modename
Fixes #3192
2019-11-12 08:54:49 +11:00
Maxime Coste
5060a4733a Add mode information to next-key mode name
Currently expose an additional name, the format is up for
discussion.

Fixes #1855
Fixes #2569
Fixes #2672
2019-11-11 21:47:47 +11:00
Maxime Coste
f119fb9524 Aggregatify ConcatView 2019-11-10 12:04:44 +11:00
Jason Felice
87e5a2f512 Avoid copy constructing BufferCoord when comparing 2019-11-09 12:53:45 -05:00
Jason Felice
9692e491ac Fix bad comparison when parsing OSI sequences 2019-11-09 12:53:45 -05:00
Jason Felice
c589f475a5 Add override 2019-11-09 12:53:45 -05:00
Jason Felice
d26bb0ce2b Add static or const where useful 2019-11-09 12:53:45 -05:00
Jason Felice
49ca512733 Remove unused trim_whitespaces() 2019-11-09 12:53:45 -05:00
Maxime Coste
d85259f801 Merge remote-tracking branch 'eraserhd/selection-list-cleanup' 2019-11-09 08:50:09 +11:00
Maxime Coste
8e63aa1548 Check that stdout is a tty in ncurses ui 2019-11-09 08:19:45 +11:00
Jason Felice
c9fce9f83d Merge selection list parsing into selection_list_from_strings 2019-11-07 14:51:04 -05:00
Maxime Coste
f794a35de3 Merge remote-tracking branch 'Delapouite/parameterdesc' 2019-11-07 20:15:14 +11:00
Maxime Coste
3e7301ede7 Support \x and \u escapes in regex character classes
Change \u to use 6 digits to cover the full unicode range.

Fixes #3172
2019-11-06 20:48:48 +11:00
Frank LENORMAND
3816f1fa43 src: Make sure clients connect from a TTY
Fixes #3159
2019-11-05 20:24:08 +01:00
Maxime Coste
294a5b72e6 Fix some ncurses rendering issues 2019-11-05 17:36:21 +11:00
Maxime Coste
6f3124d678 Split clearing to end of line out of NCursesUI::Window::draw
Explicitely clear instead of relying on a brittle heuristic.
2019-11-05 08:04:58 +11:00
Maxime Coste
0f292d343b Use a specific WrapMarker face for wrap highlighter wrapped line marker 2019-11-04 21:49:54 +11:00
Delapouite
6f6b219787 Use single_param more and add double_params 2019-11-01 18:25:55 +01:00
Maxime Coste
a49ae162f4 Add a -verbatim switch to evaluate-commands for perfect forwarding
-verbatim will disable argument parsing in evaluate-commands, making
it possible to forward a single command to a different context without
triggering a reparsing of the arguments.

Fixes -try-client support in grep.kak

Closes #3153
2019-10-23 22:30:23 +11:00
Maxime Coste
362021c1d3 Merge remote-tracking branch 'lenormf/key-semicolon' 2019-10-23 22:10:06 +11:00
Maxime Coste
db2db951c3 Only allow minus at the begining of json numbers 2019-10-23 22:08:07 +11:00
Dan Rosén
c792986768 Teach JSON parser negative numbers 2019-10-22 21:14:38 +02:00
Frank LENORMAND
21614cb06e src: Create a <semicolon> named key
This commit allows using the <semicolon> expansion in commands, instead
of `\;`.

It makes commands look more elegant, and prevents new-comers from
falling into the trap of using <a-;> without escaping the semicolon.
2019-10-22 11:02:06 +02:00
Frank LENORMAND
c744b59f7d src: Add a window_range default expansion
This commit adds a `window_range` default expansion that holds the
coordinates and size of the buffer-space on the window.

Fixes #675
2019-10-20 21:35:50 +02:00
Maxime Coste
3c34de7fe7 Remove explicit sizes from make_array calls 2019-10-17 22:48:22 +11:00
Maxime Coste
dc536da513 Split clang/gcc specific arguments 2019-10-17 12:30:24 +11:00
Maxime Coste
6a893b4e56 Limit word completion menu filename length 2019-10-17 08:15:33 +11:00
Maxime Coste
c7f106a09b Slight code style change 2019-10-17 08:15:12 +11:00
Maxime Coste
e4fb70ebec Replace ModeChange hooks by ModePush and ModePop
Remove deprecated InsertBegin, InsertEnd, NormalBegin, NormalEnd
hooks.

Closes #2545
2019-10-16 20:45:53 +11:00
Maxime Coste
3a36a2486e Slight cleanup of the menu display code 2019-10-16 20:45:53 +11:00
Maxime Coste
081595fa2f Support specifying the user configuration with KAKOUNE_CONFIG_DIR
Fixes #3072
Closes #3081
2019-10-10 20:26:27 +11:00
Delapouite
2148b84274 Add unambiguous titles for infobox "enter combining operator"
fix #3089
2019-10-10 08:34:36 +02:00
Maxime Coste
a2993ea104 Check that stdin is readable before calling read
This should not be necessary, but it works around a bug in WSL.

Fixes #3112
2019-10-08 18:38:05 +11:00
Maxime Coste
2f1be14b5f Avoid negative initial coordinates
Fixes #3111
2019-10-03 21:18:51 +10:00
Maxime Coste
aa6a7e544d Fix some clang warnings 2019-09-26 20:22:27 +10:00
Maxime Coste
1d9a9bc308 Remove unneeded NCursesUI::Window::mark_dirty and redraws
A bug in client.cc was always forcing full redraws of the windows,
leading to much more terminal output traffic than necessary.
2019-09-26 20:14:08 +10:00
Maxime Coste
7f141e83ce Additional NCursesUI code cleanups 2019-09-25 22:46:39 +10:00
Maxime Coste
2eccbbbe6f Avoid unnecessary allocations in NCursesUI::Window::draw calls
Pass an ArrayView<DisplayAtom> instead of a DisplayLine& so that
the newly common case of passing a single atom does not require
constructing a Vector.
2019-09-25 22:46:39 +10:00
Maxime Coste
f855deaf8b Refactor NCursesUI::Window to reduce the exposed methods
This should make an alternate implementation simpler as less state
has to be tracked.
2019-09-25 22:46:39 +10:00
Maxime Coste
9c2d2ad694 Do not set O_NONBLOCK on stdin
It is not necessary, and impacts also writing to stdout, leading
to broken display on old ncurses versions.

Fixes #3087
2019-09-25 20:33:01 +10:00
Maxime Coste
de3ff78b22 Restore stdin status flags on suspend and quit
Those flags are shared with the parent process, so the non-block
flag added impacts their execution.
2019-09-24 23:28:11 +10:00
Maxime Coste
f066014d33 Merge remote-tracking branch 'laelath/suppress-init-list-lifetime-warning' 2019-09-22 22:41:25 +10:00
Maxime Coste
df6d0355d6 Add support for parsing SS3 key sequences
As discussed on #3087, fixes part of that issue.
2019-09-22 09:16:47 +10:00
Justin Frank
8094ded9b5 Added -Wno-init-list-lifetime to CXXFLAGS 2019-09-17 13:38:17 -07:00
Maxime Coste
8cca77c949 Accept docstrings with last line not fully indented
When trimming indent, the last line, if only containing
whitespaces does not need to match the indent, so that
this indentation style works:

    -docstring %{
        indented string
    }
2019-09-17 21:48:00 +10:00
Maxime Coste
c787128a7c Restore palette before suspend 2019-09-16 21:57:53 +10:00
Maxime Coste
bfc07b53a2 Correctly restore terminal state on suspend 2019-09-16 07:38:24 +10:00
Maxime Coste
afd5006e8b Small style tweak 2019-09-16 07:38:24 +10:00
Maxime Coste
9235238191 Fix input coming in packets characters being dropped 2019-09-16 07:38:24 +10:00
Maxime Coste
006083c6f8 Fix multi-client server suspend 2019-09-16 07:38:24 +10:00
Maxime Coste
f43ac3d78b Fix broken input after suspend 2019-09-16 07:38:24 +10:00
Maxime Coste
e52b93b31a Setup terminal raw mode without going through ncurses 2019-09-16 07:38:24 +10:00
Maxime Coste
f2f99580f8 Get rid of ncurses based input parsing in favor of custom code 2019-09-16 07:38:24 +10:00
Maxime Coste
fc3a1b6973 Make arrow keys normal mode mappings instead of commands 2019-09-15 19:40:38 +10:00
Maxime Coste
858ae14f76 Allow scrolling while dragging mouse
Closes #2052
2019-09-15 10:27:00 +10:00
Maxime Coste
46581f1c65 Fix printing of F12 key 2019-09-08 22:54:41 +10:00
Jean-Louis Fuchs
9d897a6092 Rank a word-boundary after a non-word-boundary 2019-09-07 22:53:29 +02:00
Maxime Coste
a440869573 Fix modifiers support with mouse events 2019-09-07 22:49:30 +10:00
Maxime Coste
04b5d44b3c Rework custom CSI parsing code and add support for SGR (1006) mouse
This will support parsing mouse coordinates bigger than 255 - 32.
And get correct release support.
2019-09-07 22:29:05 +10:00
Maxime Coste
4cc187a54f Remove unneeded uses of NCurses WINDOW*
intrflush and meta have a WINDOW* parameter that is documented as
always ignored.
2019-09-05 00:25:27 +10:00
Maxime Coste
afd45c6755 Extract most ncurses calls into NCursesUI::Window methods
Try to isolate ncurses as much as possible to explore alternate
terminal UI implementation.
2019-09-05 00:25:27 +10:00
Maxime Coste
4c4eb61c18 Introduce FunctionRef to replace std::function when not storing
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-09-01 13:04:47 +10:00
Maxime Coste
b24be99fa3 Limit the amounts of calls to get_extra_word_chars
This is a relatively expensive function as it needs to resolve
an option, which uses dynamic_cast.
2019-08-31 13:14:46 +10:00
Maxime Coste
eeec8ade51 Merge remote-tracking branch 'eraserhd/pr/master/fix-kak-list-sessions' 2019-08-28 21:27:30 +10:00
Frank LENORMAND
cb2647878b src: Send the stop signal to the entire process group
Whenever a tool spawns the editor (e.g. Git), suspending it with ^Z is not
enough to be sent back to the calling shell - another ^Z is necessary.

Fixes #3061
2019-08-21 10:32:35 +02:00
Jason Felice
8d76603df4 Fix kak -l when $XDG_RUNTIME_DIR is set 2019-08-20 16:13:21 -04:00
Maxime Coste
1f4b6c3f78 Merge remote-tracking branch 'lenormf/indented-docstrings' 2019-08-19 22:21:52 +10:00
Maxime Coste
2359df0f17 Make scrolling speed configurable
The UI now can send a 'Scroll' key, whose value is the scrolling
amount encoded as a signed integer. This replaces the MouseWheelUp
and MouseWheelDown keys.

The NCursesUI now has a ncurses_wheel_scroll_amount ui_option that
controls that amount, it can be negative to swap scrolling direction.

Fixes #3045
2019-08-19 22:16:39 +10:00
Maxime Coste
f1047181cb Fallback to wrapping in between 'word' when 'WORD' fails
First try to break at a whitespace, if that fails (likely because
that last WORD is too long for the wrapping width), then try to
wrap at a 'word' boundary (on a non alphanumeric character).

Fixes #3048
2019-08-12 18:40:56 +10:00
Jason Felice
0e4a4acf61 Use $XDG_RUNTIME_DIR
Falls back on old mechanism if `XDG_RUNTIME_DIR` is not set.

The ability to specify a session as "<user>/<name>" was removed, since
it isn't possible to compute the value of `XDG_RUNTIME_DIR` for another
user, we wouldn't have access to it if we could, and it would be awkward
to support this feature only when `XDG_RUNTIME_DIR` is unset.  Also,
`rename-session` did not work when another user's session was specified.

Closes #3019
2019-08-05 11:57:07 -04:00
Maxime Coste
1c6aa9baed Fix bug in WrapHighlighter::do_compute_display_setup
Additional lines were not pulled correctly when a line was removed
due to its wrapping hiding the cursor.

Fixes #2999
2019-08-05 20:16:59 +10:00
Frank LENORMAND
da2f6c296a src: De-indent docstrings passed to command/option/mapping definitions
This commit implements formatting behaviour when the first character of a
docstring is a newline. In that case, the exact indentation level of the
next line will be removed from that line and all subsequent non-empty lines.

An error will be returned if a subsequent non-empty line does not have the
same indentation level.

The docstrings are always trimmed (surrounding whitespaces) whether the
first character is a newline or not, as was the case prior to this commit.

Example: the following declaration

```
define-command test -docstring %{
    test: do something

    Nothing really.
        More
            indented
                lines.
} nop
```

would be rendered as

```
test: do something

Nothing really.
    More
        indented
            lines.
```

Related to #2405
2019-07-25 12:28:04 +03:00
Maxime Coste
e42c81c8eb Ensure current context switches away from buffer on delete-buffer
Fixes #3025
2019-07-22 20:26:39 +10:00
Maxime Coste
39445f9acb save command history in execute-keys by default
This should make #3014 unnecessary
2019-07-21 12:29:52 +10:00
Maxime Coste
1a16590960 Slight code cleanup in prompt history handling 2019-07-21 12:20:47 +10:00
Maxime Coste
b83c09509e Merge branch 'master' of http://github.com/jo-he/kakoune 2019-07-21 12:15:48 +10:00
Maxime Coste
b18ca12882 More functional style for '*' code 2019-07-21 12:14:25 +10:00
Maxime Coste
c54e0ec873 Merge remote-tracking branch 'lenormf/fix-2994' 2019-07-21 12:10:22 +10:00
Maxime Coste
be3d0f8b33 Filter non-extra_word_chars completion candidates using Codepoints
Fixes #3010
2019-07-09 19:36:57 +10:00
Maxime Coste
c2e43ee42c Use -O0 for debug builds
-Og is not nice enough to work with in gdb, control jumps around
in too unpredictible ways due to inlining.
2019-07-09 19:27:55 +10:00
Joachim Henke
556d58a073 allow for mapping the Insert key 2019-07-07 18:38:46 +02:00
Maxime Coste
3a7d0b67fa Merge remote-tracking branch 'lenormf/fix-history-size' 2019-07-07 09:14:25 +10:00
Maxime Coste
9e62d2c345 Merge branch 'master' of http://github.com/jo-he/kakoune 2019-07-07 09:13:11 +10:00
Joachim Henke
4c61f82fb2 fix a few typos 2019-07-06 17:37:30 +02:00
Tobias Kortkamp
16bb55edee
Fix build on FreeBSD
file.cc:390:21: error: use of undeclared identifier 'rename'; did you mean 'devname'?
    if (replace and rename(temp_filename, zfilename) != 0)
                    ^~~~~~
                    devname
/usr/include/stdlib.h:277:7: note: 'devname' declared here
char    *devname(__dev_t, __mode_t);
         ^
file.cc:390:28: error: cannot initialize a parameter of type '__dev_t' (aka 'unsigned long') with an lvalue of type 'char [1024]'
    if (replace and rename(temp_filename, zfilename) != 0)
                           ^~~~~~~~~~~~~
/usr/include/stdlib.h:277:22: note: passing argument to parameter here
char    *devname(__dev_t, __mode_t);
                        ^
2 errors generated.

---

highlighters.cc:1110:13: error: use of undeclared identifier 'snprintf'; did you mean 'vswprintf'?
            snprintf(buffer, 16, format, std::abs(line_to_format));
            ^~~~~~~~
            vswprintf
/usr/include/wchar.h:139:5: note: 'vswprintf' declared here
int     vswprintf(wchar_t * __restrict, size_t n, const wchar_t * __restrict,
        ^
highlighters.cc:1110:22: error: cannot initialize a parameter of type 'wchar_t *' with an lvalue of type 'char [16]'
            snprintf(buffer, 16, format, std::abs(line_to_format));
                     ^~~~~~
/usr/include/wchar.h:139:35: note: passing argument to parameter here
int     vswprintf(wchar_t * __restrict, size_t n, const wchar_t * __restrict,
                                      ^
2 errors generated.

---

json_ui.cc:60:13: error: use of undeclared identifier 'sprintf'; did you mean 'swprintf'?
            sprintf(buf, "\\u%04x", *next);
            ^~~~~~~
            swprintf
/usr/include/wchar.h:133:5: note: 'swprintf' declared here
int     swprintf(wchar_t * __restrict, size_t n, const wchar_t * __restrict,
        ^
json_ui.cc:60:21: error: cannot initialize a parameter of type 'wchar_t *' with an lvalue of type 'char [7]'
            sprintf(buf, "\\u%04x", *next);
                    ^~~
/usr/include/wchar.h:133:34: note: passing argument to parameter here
int     swprintf(wchar_t * __restrict, size_t n, const wchar_t * __restrict,
                                     ^
json_ui.cc:74:9: error: use of undeclared identifier 'sprintf'
        sprintf(buffer, R"("#%02x%02x%02x")", color.r, color.g, color.b);
        ^
3 errors generated.

---

regex_impl.cc:1039:9: error: use of undeclared identifier 'sprintf'; did you mean 'swprintf'?
        sprintf(buf, " %03d     ", count++);
        ^~~~~~~
        swprintf
/usr/include/wchar.h:133:5: note: 'swprintf' declared here
int     swprintf(wchar_t * __restrict, size_t n, const wchar_t * __restrict,
        ^
regex_impl.cc:1039:17: error: cannot initialize a parameter of type 'wchar_t *' with an lvalue of type 'char [20]'
        sprintf(buf, " %03d     ", count++);
                ^~~
/usr/include/wchar.h:133:34: note: passing argument to parameter here
int     swprintf(wchar_t * __restrict, size_t n, const wchar_t * __restrict,
                                     ^
regex_impl.cc:1197:17: error: use of undeclared identifier 'puts'
    { if (dump) puts(dump_regex(*this).c_str()); }
                ^
regex_impl.cc:1208:18: note: in instantiation of member function 'Kakoune::(anonymous namespace)::TestVM<Kakoune::RegexMode::Forward>::TestVM' requested here
        TestVM<> vm{R"(a*b)"};
                 ^
regex_impl.cc:1197:17: error: use of undeclared identifier 'puts'
    { if (dump) puts(dump_regex(*this).c_str()); }
                ^
regex_impl.cc:1283:56: note: in instantiation of member function 'Kakoune::(anonymous namespace)::TestVM<5>::TestVM' requested here
        TestVM<RegexMode::Forward | RegexMode::Search> vm{R"(f.*a(.*o))"};
                                                       ^
regex_impl.cc:1197:17: error: use of undeclared identifier 'puts'
    { if (dump) puts(dump_regex(*this).c_str()); }
                ^
regex_impl.cc:1423:57: note: in instantiation of member function 'Kakoune::(anonymous namespace)::TestVM<6>::TestVM' requested here
        TestVM<RegexMode::Backward | RegexMode::Search> vm{R"(fo{1,})"};
                                                        ^
5 errors generated.

---

remote.cc:829:9: error: use of undeclared identifier 'rename'; did you mean 'devname'?
    if (rename(old_socket_file.c_str(), new_socket_file.c_str()) != 0)
        ^~~~~~
        devname
/usr/include/stdlib.h:277:7: note: 'devname' declared here
char    *devname(__dev_t, __mode_t);
         ^
remote.cc:829:16: error: cannot initialize a parameter of type '__dev_t' (aka 'unsigned long') with an rvalue of type 'const char *'
    if (rename(old_socket_file.c_str(), new_socket_file.c_str()) != 0)
               ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/stdlib.h:277:22: note: passing argument to parameter here
char    *devname(__dev_t, __mode_t);
                        ^
2 errors generated.

---

string_utils.cc:126:20: error: use of undeclared identifier 'sprintf'; did you mean 'swprintf'?
    res.m_length = sprintf(res.m_data, "%i", val);
                   ^~~~~~~
                   swprintf
/usr/include/wchar.h:133:5: note: 'swprintf' declared here
int     swprintf(wchar_t * __restrict, size_t n, const wchar_t * __restrict,
        ^
string_utils.cc:126:28: error: cannot initialize a parameter of type 'wchar_t *' with an lvalue of type 'char [15]'
    res.m_length = sprintf(res.m_data, "%i", val);
                           ^~~~~~~~~~
/usr/include/wchar.h:133:34: note: passing argument to parameter here
int     swprintf(wchar_t * __restrict, size_t n, const wchar_t * __restrict,
                                     ^
string_utils.cc:133:20: error: use of undeclared identifier 'sprintf'; did you mean 'swprintf'?
    res.m_length = sprintf(res.m_data, "%u", val);
                   ^~~~~~~
                   swprintf
[...]
2019-07-06 08:53:47 +02:00
Frank LENORMAND
78129150c9 src: Cap the maximum size of history registers
History registers (for prompt commands, pipe primitive commands etc) are
populated interactively by the users, and currently have no size limit.

This commits silently drops the oldest entries in the storage space to
allow at most 100 entries, to prevent long-running editing sessions from
hogging memory for data most likely never used.
2019-07-02 16:36:12 +03:00
Frank LENORMAND
b040bf8b81 src: Use all selections to generate a pattern upon hitting *
This commit makes the `*` and <a-*> primitives compose a search pattern
comprised of all the current selections, as opposed to only the main one.

All selections are OR'd into the default search register, which makes it
convenient to search for several identifiers already selected.

To retain the old behaviour, the following mappings can be used:

```
map global normal * ': exec -draft -save-regs "" %{<space>*}<ret>'
map global normal <a-*> ': exec -draft -save-regs "" %{<space><a-*>}<ret>'
```

Fixes #2994
2019-07-01 19:53:08 +03:00
Maxime Coste
2ff9fd8d92 Kakoune v2019.07.01 2019-07-01 22:07:29 +10:00
Maxime Coste
aff3e7d5b7 Merge remote-tracking branch 'lenormf/fix-2907-2' 2019-06-29 09:54:51 +10:00
Maxime Coste
eae92c9ae3 Merge remote-tracking branch 'codesoap/rename_moduleload' 2019-06-29 09:52:20 +10:00
Maxime Coste
e4d6bff5ec Fix quoting of tuple options
Fixes #2990
2019-06-27 22:42:12 +10:00
codesoap
ca2741fe20 Rename ModuleLoad hook to ModuleLoaded
This clarifies, that the hook is run *after* the module is loaded.
2019-06-25 19:16:47 +02:00
Frank LENORMAND
4c7bc9179b src: Enforce case sensitivity when parsing function keys
The `parse_keys()` function is case insensitive when parsing function keys,
while the `key_to_str()` function always returns a capitalized key
description.

When users hook on the lowercase name of a function key,
e.g. `NormalKey <f10>`, and later hit that same key in normal mode, the
`key_to_str()` will convert it to the uppercase description ("<F10>").

This results into a hook with a lowercase regex predicate being unsuccessfully
matched against an uppercase key description by the hook manager, which
works on a case sensitive basis.

One solution could be to uppercase all function key descriptions passed as
hook filter upon declaration, but detecting that is not trivial as the
filter can contain more than just the simple <f\d+> data, e.g.

---
hook global InsertKey '<(?<name>\w+)>' %{…}
---

Another simpler solution that this commit implements is to allow only <F\d+>
descriptions in `parse_keys()`, and hope users will know not to use the
lowercase notation when declaring hooks.

Fixes #2907
2019-06-24 18:17:49 +03:00