1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-08-17 00:30:26 +03:00
Commit Graph

10466 Commits

Author SHA1 Message Date
Maxime Coste
83be9a03bc Merge remote-tracking branch 'dontlaugh/debug_mapping_output' 2024-05-29 21:44:07 +10:00
Maxime Coste
599a605f28 Merge remote-tracking branch 'dontlaugh/patch-1' 2024-05-29 21:41:50 +10:00
Maxime Coste
0aa6665154 Merge remote-tracking branch 'dontlaugh/patch-2' 2024-05-29 21:41:47 +10:00
Maxime Coste
3878c56f8d Merge remote-tracking branch 'm-kru/typst' 2024-05-29 21:39:24 +10:00
Michał Kruszewski
6d2b57d0ca tcl: Highlight variables as variables, not as values 2024-05-26 09:04:28 +02:00
Michał Kruszewski
6a853716c9 typst: Add typst.kak for typst markup highlighting 2024-05-23 15:01:26 +02:00
Coleman McFarland
2c1e238a0c
doc: declare C++20 as the language version
Technically we seem to be compiling with `-std=c++2a` which (if I
understand correctly) is "all the features we have from 23 and up.

But 20 is the earliest version that compiles for me (with clang). 14 and 17 didn't work.
2024-05-22 19:18:47 -04:00
Coleman McFarland
7818ea0cbb Add right hand side mapping to "debug mappings" 2024-05-22 18:45:54 -04:00
Coleman McFarland
52d264df27 doc: clarify that C and <a-C> act column-wise 2024-05-22 18:24:00 -04:00
Maxime Coste
1bd50261c8 Kakoune 2024.05.18 2024-05-18 14:43:06 +10:00
Johannes Altmanninger
7a90473267 Revert "Make TerminalUI::get_next_key() helpers static"
On macOS, backspace reportedly no longer works after <c-z> and fg.
The value of m_original_termios.c_cc[VERASE] seems to be wrong
in a static lambda that captures a singleton "this".
Not sure what's the problem. I thought that it is guaranteed that
"static auto convert = [this]() { ... }" is initialized lazily,
hence it should capture the correct address. Maybe the address
changes somehow or it's UB / a compiler bug.

This reverts commit ad36585b7a

Closes #5155
2024-05-18 11:35:48 +10:00
Chris Webb
4e5631daf3 Handle binary path detection errors on non-/proc platforms
On FreeBSD and NetBSD, sysctl() can return -1 when the path is too long,
leaving the buffer unitialised.

On macOS, both _NSGetExecutablePath() and realpath() can fail with
pathological paths or if memory is exhausted.

On Haiku, the kak_assert(status == B_OK) check will be compiled out in
non-debug builds.

Detect all of these cases and error out, reshaping get_kak_binary_path()
to avoid multiple repetitions of the same fatal error message.
2024-05-12 21:59:56 +10:00
Chris Webb
97a5d68adf Fix error handling when reading binary path from /proc
On Linux, Hurd, Cygwin, DragonFly BSD and Solaris/Illumos, Kakoune obtains
a path to its binary by reading the appropriate /proc symlink target.
readlink() can fail or it can fill the entire buffer, silently truncating
the path if the buffer is too small.

kak_assert() is compiled out in non-debug builds so we ignore a readlink()
failure, corrupt the stack by writing to buffer[-1] then return a string
from the uninitialised buffer.

If readlink() succeeds and the binary path is sizeof(buffer) long, we write
a \0 terminator beyond its end. If it is longer, we also truncate the path.

Throw a fatal error on startup in all these unlikely failure cases.
2024-05-12 21:59:52 +10:00
Maxime Coste
0e92b3fdef Fix another case where git tests were hanging 2024-05-12 14:18:17 +10:00
Maxime Coste
7be22f1ec2 Fix tests for OpenBSD
Using the diff provided by @krobelus on #5173

Close #5173
2024-05-12 11:14:17 +10:00
Maxime Coste
8c2775f665 Fix tests that were failing on alpine
Ensure perl exists for git blame tests, replace timing sensitive
`ui_out -ignore ...` with `ui_out -until '...'`
2024-05-10 12:07:45 +10:00
Maxime Coste
b4a485a1e4 Fix release directory name and version file location 2024-05-09 21:01:53 +10:00
Maxime Coste
8bb0f44c2b Kakoune 2024.05.09 2024-05-09 20:15:32 +10:00
Maxime Coste
1c71fc0c09 Add local scope to user commands 2024-04-29 12:21:02 +10:00
Maxime Coste
e8ad943532 Ensure re-used fifo buffers makes that buffer the latest opened 2024-04-27 16:31:40 +10:00
Maxime Coste
da1c302a37 Make grep-(next|prev)-match use the latest buffer matching \*grep(-.*)\* 2024-04-27 16:31:40 +10:00
Maxime Coste
5fd9bb59e3 Add buffer -matching switch 2024-04-27 16:31:40 +10:00
Johannes Altmanninger
aad0c7cef8 Don't capture local-scoped faces in prompt
ASan shows that we resolve a face spec owned by a freed stack variable.

    =================================================================
    ==2263300==ERROR: AddressSanitizer: stack-use-after-return on address 0x7a9316c33918 at pc 0x633ea421d8ea bp 0x7ffca001e980 sp 0x7ffca001e970
    READ of size 8 at 0x7a9316c33918 thread T0
        ...
        #6 0x633ea421d8e9 in Kakoune::FaceRegistry::resolve_spec(Kakoune::FaceSpec const&) const src/face_registry.cc:128
        ...

    Address 0x7a9316c33918 is located in stack of thread T0 at offset 2328 in frame
        #0 0x633ea427a095 in operator() src/commands.cc:2267

      This frame has 26 object(s):
        [32, 36) '<unknown>'
        ...
        [544, 560) 'disable_hooks' (line 2269)
        ...
        [928, 2432) 'local_scope' (line 2271) <== Memory access at offset 2328 is inside this variable
2024-04-27 16:29:57 +10:00
Johannes Altmanninger
ab2ecf423e Adjust test/highlight/rust/value
A recent commit highlights char literals as value (default red)
instead of yellow.
2024-04-27 16:29:57 +10:00
Coleman McFarland
f9b2f818c0 Coleman E. McFarland Copyright Waiver
I dedicate any and all copyright interest in this software to the
public domain.  I make this dedication for the benefit of the public at
large and to the detriment of my heirs and successors.  I intend this
dedication to be an overt act of relinquishment in perpetuity of all
present and future rights to this software under copyright law.
2024-04-25 21:16:17 -04:00
Maxime Coste
5d2b8351a6 Merge remote-tracking branch 'm-kru/rust' 2024-04-20 16:07:07 +10:00
Maxime Coste
63addb7faa Use a nested command completer for the evaluate-commands command 2024-04-19 15:40:33 +10:00
Maxime Coste
b4fbfba246 Complete complete-command completer type 2024-04-19 15:36:23 +10:00
Michał Kruszewski
8870c7e1f0 rust: Highlight char and byte literals as values
Char and byte literals are values.
There is no point in using fixed colors for them.
2024-04-16 19:19:12 +02:00
Maxime Coste
3d7d0fecca Introduce "local" scope in evaluate-commands
When using `eval` a new scope named 'local' gets pushed for the
whole evaluation, this makes it possible to temporarily set
an option/hook/alias...

Local scopes nest so nested evals do work as expected.

Remove the now trivial with-option command
2024-04-12 15:28:40 +10:00
Maxime Coste
b1c114bf6d Make removing an unknown highlighter an error
Fail instead of silently doing nothing, this makes it easier to
toggle highlighters using a try/catch
2024-04-12 15:28:40 +10:00
Maxime Coste
7f556c1e87 Rotate through strings when pasting instead of repeating the last
This seems like a better overall behaviour.

Closes #5135
2024-04-12 15:28:22 +10:00
Maxime Coste
e34735a350 Add missing <bit> include 2024-04-01 11:41:50 +11:00
Maxime Coste
6626d1cfa6 Fix std::optional used instead of Optional 2024-04-01 11:33:51 +11:00
Maxime Coste
917db454d9 Change mode_info to contain an optional NormalParams
As @topisani pointed out in #5131, it is more user friendly to always
provide a %val{register} and %val{count} regardless of the mode.
2024-04-01 11:03:22 +11:00
Maxime Coste
cc935c8cc6 Merge remote-tracking branch 'm-kru/vhdl' 2024-04-01 10:46:55 +11:00
Maxime Coste
1e80c20a5d Fix MacOS shell expensions in Makefile 2024-03-31 21:42:49 +11:00
Maxime Coste
303d879785 Support exposing some env vars as part of the mode information
This should implement what #5131 proposed in a different way.

Closes #5131
2024-03-31 21:38:51 +11:00
Maxime Coste
7d0f25a99c Merge remote-tracking branch 'topisani/session-client-rename-hooks' 2024-03-31 20:55:21 +11:00
Maxime Coste
dc123e71ae Add redundant $(shell ...) in Makefile to fix builds on MacOS
MacOS uses an old GNU make that does not support the != syntax.

That syntax is not Posix (yet, it is accepted for next standard) but
we really need a way to call the shell from a Makefile. Hopefully we
can remove this soon (not holding my breath though)

Fixes #5117
2024-03-31 20:19:25 +11:00
Johannes Altmanninger
7b93567bb1 Reset SIGINT handler in background processes
In a noninteractive shell, asynchronous commands ignore SIGINT and
SIGQUIT. We typically use such shells to feed fifo buffers which we
do want to cancel them on Control-C.  Make it so.

Same for SIGQUIT; that one is not typically used but I expect that
along the Kakoune server it kills any child processes that (haven't
been daemonized).

Note that for unknown reasons, Bash already doesn't ignore SIGINT in
async processes that use "eval".

Note that Dash has a bug that prevents this from working;
proposed fix is at
https://lore.kernel.org/dash/20240329153905.154792-2-aclopte@gmail.com/

(While at it balance out some parens, to help the m command)
2024-03-31 20:13:35 +11:00
Johannes Altmanninger
5d00b80d1a Revert "Send SIGTERM on <c-c>, to more reliably kill background jobs"
Overloading SIGTERM like that causes issues; specifically if the
editor is invoked (without exec) from a wrapper script.

By sending SIGTERM to whole process group, we kill our parent process
(the wrapper script) which then sends SIGTERM to Kakoune.  By this
time Kakoune has already reset the SIGTERM handler to the default
action and terminates.

We can use a different fix for the problem that some shells don't
cancel "make", see the next patch.

This reverts commit ec44d98347.
2024-03-31 20:13:35 +11:00
Tobias Pisani
a1880a5441 Add SessionRenamed hook 2024-03-27 17:59:05 +01:00
Tobias Pisani
5515383ae4 Add ClientRenamed hook 2024-03-27 17:59:05 +01:00
Maxime Coste
9faad8c023 Slight code cleanup in the DynamicRegexHighlighter 2024-03-27 22:10:04 +11:00
Maxime Coste
2f7568485f Merge remote-tracking branch 'topisani/indent-guides' 2024-03-27 21:56:25 +11:00
Maxime Coste
390bff3435 Do not make cursor visible when not dragging
Fixes #5130
2024-03-27 19:07:09 +11:00
Tobias Pisani
b9c60e2578 Add -indent option to show-whitespace highlighter
A couple of semi-opinionated choices were made in this implementation:

 1. The guide is hidden in the first column.
 2. The indent guides are highlighted using a new `WhitespaceIndent` face.
 3. Nothing is done to continue the guide through empty lines. I believe this to be the correct approach,
    at least as long as it is kept as a part of the show-whitespaces highlighter. However some people's
    oppinion may differ, and if so, that could be implemented.
 4. The guides default to on, like the other show-whitespace options. Default character is "│".
 5. Spaces between the indent guides are currently highlighted as other spaces.
    Other reasonable options would be no replacement, -tabpad, or a similar -indentpad.
 6. Guides are disabled by passing `-indent ""`.
 7. Indent guides are separate from tab highlighting.

Additionally, we could consider adding a separate face for the "current" indent level as many editors do,
but this is a bit harder in kakoune because of multiple selections.

Closes #2323
2024-03-27 04:07:12 +01:00
Michał Kruszewski
928f405fde vhdl: Highlight integer_vector type and work library 2024-03-25 14:01:39 +01:00
Maxime Coste
610d4114a9 Merge remote-tracking branch 'm-kru/tcl' 2024-03-23 21:10:07 +11:00