Commit Graph

10185 Commits

Author SHA1 Message Date
Maxime Coste
7a130c89ce Merge remote-tracking branch 'jdugan6240/odin-support' 2023-11-05 13:48:57 +11:00
Maxime Coste
25a00bf2a9 Remove ignored packed attribute and static_assert on Node size
This static_assert is not necessary for the code to work and is
not valid on every platform.
2023-11-05 12:38:39 +11:00
Maxime Coste
0880399fbe Replace snprintf with format_to 2023-11-05 12:30:54 +11:00
Maxime Coste
465e0280d8 Merge remote-tracking branch 'Screwtapello/document-non-recursive-mappings' 2023-11-05 11:25:40 +11:00
Maxime Coste
1da8952e1f Merge remote-tracking branch 'lobre/git-edit' 2023-11-05 11:12:43 +11:00
Maxime Coste
cf6e18e3c1 Merge remote-tracking branch 'krobelus/stop-busy-polling-of-command-socket' 2023-11-05 11:11:02 +11:00
Maxime Coste
c0788f370b Merge remote-tracking branch 'krobelus/patch-selected-lines' 2023-11-05 11:09:41 +11:00
Johannes Altmanninger
b0ddbfc2df Do not poll command sockets while shell command is running
Accepter is a wrapper around a socket watcher. It always uses
EventMode::Urgent, so it will be included in pselect(2) (via
EventManager::handle_next_events()) even while we are waiting for a
(blocking) shell command.  However we will not execute the command
received on this socket until after the shell command is done.

This is implemented with an early return:

	void handle_available_input(EventMode mode)
	{
	    while (not m_reader.ready() and fd_readable(sock))
	        m_reader.read_available(sock);

	    if (mode != EventMode::Normal or not m_reader.ready())
	        return;

so we read available data but don't close the socket.
When using this reproducer

	{
		sleep 1 && echo 'nop' | kak -p session
	} &
	kak -n -s session -e '%sh{sleep 7}'

the first "m_reader.read_available(sock);" will read "nop".  Then
"m_reader.ready()" is true but the socket is still readable. This
means that pselect(2) will return it every time, without blocking.

This means that the shell manager runs a hot loop between pselect(2)
and waitpid(2).

Fix this problem demoting command socket watchers from
EventMode::Urgent. This means that we won't pselect(2) it when handling
only urgent events. Control-C still works, I'm not sure why.

Alternative fix: we could read the commands but then disable the
socket. I tried this but it seems too complex.

Closes #5014
2023-11-04 17:48:25 +01:00
Loric Brevet
83b7bbdc55
rc/tools/git: edit a git indexed file with git edit 2023-11-04 13:43:10 +01:00
Johannes Altmanninger
286dab11d4 rc tools git: "git apply" to apply selections in diffs
This adds a somewhat discoverable frontend for common uses of the
patch command.

Here are some frequently used commands

	# apply selected changes
	git apply 
	# revert selected changes
	git apply -R
	# stage selected changes
	git apply --cached
	# unstage selected changes
	git apply --cached -R
	# apply selected changes and stage them
	git apply --index

For everyday use that's a lot of typing so I recommend adding mappings.
2023-11-04 12:14:48 +01:00
Johannes Altmanninger
8c0424b521 rc tools patch: "patch" command to apply selections in diffs to file
One of the features I miss most from Magit/Fugitive/Tig is to
apply/revert/stage/unstage individual hunks or even exactly the
selected line(s).  This provides a much more convenient way of
splitting changes than "git add/restore -p".

Implement a "patch" command that applies the selected lines within
a diff by piping them to the "patch" program.
It can also feed other programs like "git apply" (see the next commit).

Original discussion: https://discuss.kakoune.com/t/atomic-commits-in-kakoune/1446

Interestingly, :patch is defined outside the "patch" module. This is
to make it readily available for interactive use.
Putting it into the module does not save any work.
I tentatively added a patch module anyway so we can explicitly declare
this dependency.. although there is the argument that this is not
really needed?
2023-11-04 12:14:48 +01:00
Maxime Coste
a8a53cc003 Merge remote-tracking branch 'phaazon/custom-diff-char' 2023-11-04 13:58:09 +11:00
Maxime Coste
0924401c50 Merge branch 'patch-1' of https://github.com/tomsaleeba/kakoune 2023-11-04 11:22:24 +11:00
Tom Saleeba
1e8d2dfe9b
remove "introduced..." fragments 2023-11-04 08:30:29 +11:00
Dimitri Sabadie
27f19fdd91
Rename diff_* into git_diff_*. 2023-11-03 22:04:22 +01:00
Dimitri Sabadie
da2cc1ac3c
Revert adding doc about git_diff_*. 2023-11-03 22:04:22 +01:00
Dimitri Sabadie
8e10822a87
Support setting diff characters in git diffs.
This commit adds `diff_add_char`, `diff_mod_char`, `diff_del_char` and `diff_top_char` as `str` options, with typical
defaults.

This commit also replaces the hard coded +, _, ≃, etc. hardcoded characters in `git update-diff` to use the options from
above.
2023-11-03 22:04:22 +01:00
Dimitri Sabadie
9e4dbdbe6c
Dimitri Sabadie 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.
2023-11-03 22:04:22 +01:00
Maxime Coste
6a39ac224b Merge remote-tracking branch 'krobelus/fix-quoted-vals-expand' 2023-11-03 21:51:36 +11:00
Maxime Coste
f7499ccf45 Add support for 0-padding in format and replace uses of sprintf 2023-11-03 20:27:41 +11:00
Johannes Altmanninger
8a3613e5a0 Fix "%val{selections_desc}" being joined by nul instead of space
This should fix a bug in lint.kak though I didn't check.
2023-11-03 06:45:02 +01:00
Maxime Coste
7577fa1b66 Use explicit target types for gather calls to bypass clang regression
Since clang-16 there has been a regression in the P0522R0 support.
(Bug report at https://github.com/llvm/llvm-project/issue/63281)

Closes #4892
2023-11-03 13:08:44 +11:00
Maxime Coste
c889c0329c Replace std::lexicographical_compare_three_way with custom code
On latest MacOS this function is still not implemented
2023-11-03 13:08:26 +11:00
Tom Saleeba
481783c9c5
mention <a-u> and <a-U> (selection undo/redo) in readme 2023-11-03 12:20:47 +11:00
Maxime Coste
154a393c7b Merge remote-tracking branch 'arrufat/zig-syntax' 2023-11-02 18:29:35 +11:00
Maxime Coste
41e57f62dc Merge branch 'juliacolors' of http://github.com/chriselrod/kakoune 2023-11-02 18:28:53 +11:00
Maxime Coste
e882c23501 Merge remote-tracking branch 'greenfork/improve-janet-syntax' 2023-11-02 18:21:59 +11:00
Maxime Coste
81d94ac06c Merge remote-tracking branch 'ii8/master' 2023-11-02 18:21:15 +11:00
Maxime Coste
cfcd15e37f Merge remote-tracking branch 'QiBaobin/make-error' 2023-11-02 18:17:01 +11:00
Maxime Coste
ba0cd553ba Display a message on the tty directly on fatal error
Remove the xmessage/MessageBox based implementation.
2023-11-02 18:16:43 +11:00
Adrià Arrufat
0015a29c19 rc/filetype/zig: remove align builtin and add f80 type
In commit ca36d0d228
the align function was added as a builtin accidentally.

Also, f80 type was added in Zig 0.10.0: https://ziglang.org/download/0.10.0/release-notes.html#f80
2023-11-02 12:13:41 +09:00
Maxime Coste
a2c41593aa Fix partial regex text being pushed in history 2023-11-02 13:00:12 +11:00
Bob Qi
8424fbe0f0 rc/make.kak reuse make_error_pattern 2023-11-02 09:11:18 +08:00
chriselrod
7bc1504725
@macro! 2023-11-01 17:23:03 -04:00
Maxime Coste
8cc4de5bb3 Always ensure we do not scroll past the last line
An assert fails from time to time after reloading fifo buffers due
to being scrolled past the last line of the buffer. A repro case was
not found but this should fix the underlying issue.
2023-11-01 17:24:54 +11:00
chriselrod
bf4f780cfa
Many more Julia operators 2023-10-31 23:13:33 -04:00
chriselrod
e48d81d20b
Add more highlighters for Julia 2023-10-31 22:49:19 -04:00
Dmitry Matveyev
4332b0dc71 janet: syntax improvements and trailing whitespace cleaning 2023-10-31 11:15:38 +04:00
murray
b20747d44e Gren highlighting
Gren is an elm fork and it's syntax is currently still
similar enough to use the same highlighter.
2023-10-29 20:51:42 +00:00
Bob Qi
760f63b827 rc/make.kak set option type to be regex 2023-10-29 09:05:33 +08:00
Bob Qi
cb540def46 rc/make.kak avoid another using pattern directly 2023-10-27 10:16:57 +08:00
Bob Qi
8e5ca3f214 rc/make.kak introduce a new option to be back compatible 2023-10-27 09:57:10 +08:00
Bob Qi
2d849cc147 rc/make.kak set search register to avoid injection 2023-10-27 08:25:38 +08:00
Bob Qi
d0571ce238 rc/make.kak support override the whole error line pattern 2023-10-26 10:13:07 +08:00
Maxime Coste
2fa55be40a Default comparison operators that can be 2023-10-25 21:06:52 +11:00
Maxime Coste
96884193dd Remove redundant comparison operators
Since C++20 (a != b) get automatically rewritten as !(a == b) if
the != operator does not exist.
2023-10-25 20:40:04 +11:00
Maxime Coste
d1c8622dc7 Clear buffer values on fifo buffer recreation
The cached WordDB/Highlighters/FifoReader are not relevant and are
better fully rebuilt than updated. This speeds up rebuilding the
WordDB of big fifo buffers such as a `git log`.
2023-10-25 12:53:55 +11:00
Maxime Coste
be33dee211 Speed up WordSplitter
Only do utf8 decoding once per codepoint instead of twice, limit
the byte length instead of the codepoint length.
2023-10-25 12:52:14 +11:00
Maxime Coste
b33b673f10 Remove unnecessary operator (since C++20) 2023-10-25 12:51:59 +11:00
Maxime Coste
b020922e6f Fix some corner cases in c-family indentation 2023-10-25 12:51:16 +11:00