1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-11-22 22:55:26 +03:00
Commit Graph

10622 Commits

Author SHA1 Message Date
Maxime Coste
9358c62bf2 Take a timeout argument in EventManager::handle_next_events
When provided, this gives the maximal time to wait before exiting
handle_next_events. If not given handle_next_events will block, this
provides a more flexible approach than the previous "block" boolean.

Use this to wait for a millisecond between each try to open a fifo
for writing.

Fixes the 100% cpu usage discussed in github on commit
e74a3ac6a3
2024-11-22 13:51:09 +11:00
Maxime Coste
e74a3ac6a3 Run urgent event loop when blocking on opening a file for writing
This makes <c-g> cancel the writing operation if we block on trying
to open a fifo with no reader.

Fixes #5256
2024-11-16 10:50:17 +11:00
Johannes Altmanninger
d86e505fad Fail rename-session instead of creating overlong socket paths
Commit 9cf8a3ccd (Check for buffer overflow when constructing the socket path., 2022-04-07)
made

	$ kak -s $(printf %0100d)

fail but forgot to do the same for

	$ kak -e "rename-session $(printf %0100d)"

which silently succeeds, only to fail at the next

	$ echo nop | kak -p $(printf %0100d)
	Fatal error: socket path too long: '/run/user/1000/kakoune/0000...'

Let's fail earlier.

While at it, don't validate "m_session" redundantly.

I'm not sure if we should validate the socket names in "kak -clear";
I guess it doesn't matter.
2024-11-12 08:54:19 +11:00
Johannes Altmanninger
919934177d Update line highlighting test
Commit 8c49c8ee4 (Highlight all atoms for the line regardless of
has_buffer_range, 2024-11-04) intentionally changes the behavior
to also highlight outside the buffer, painting over number-lines.
Let's use a final face as suggested to restore the test's previous
behavior, fixing the failure.
2024-11-11 21:30:03 +11:00
Johannes Altmanninger
8c74660ad3 Remove noisy output from tests
"ui_out -until-grep" invocations used to redirect the output from
grep, usually to /dev/null.  Looks like the intention of 60fcc3443
(Change ui_out -until-grep to check for equality the next argument,
2024-11-02) was that grep no longer needs to print output, since we
can assert instead which is mildly better.

Unfortunately there are two places where -until-grep might not be
powerful enough, which is why we capture the output and check it
in the test script. For one of them we can use -until-grep with a
small change.  Not yet sure about the other one. Let's try to use
eval instead, so we can silence the output.

I realize -until-eval is not great (the nested quoting is ugly)
but I guess it's better than the status quo.

Alternatively, we could print output only if the [expected] argument
is not given, and add >/dev/null to the other invocations.
2024-11-11 21:30:01 +11:00
Johannes Altmanninger
66aa444c6f Simplify ui_out argument parsing
Tests print a confusing error

	./run: line 214: shift: shift count out of range

This is because ui_out -until-grep now shifts twice which conflicts
with the weird shift at the end of ui_out.

It also has a loop, making it possible to do something like "ui_out
foo bar baz" to expect three different messages.  We don't use this
feature anywhere, and it seems just super surprising, given that
ui_out now consumes between 1 and 3 arguments each time.  Let's get
rid of the loop, and always run shift right next to where we actually
use the argument. This should make things less brittle.
2024-11-11 21:29:56 +11:00
Maxime Coste
8c49c8ee40 Highlight all atoms for the line regardless of has_buffer_range
This changes the behaviour with say line numbers and other line
flags, but can be opted out by using final faces

Fixes #5253
2024-11-04 20:59:20 +11:00
Johannes Altmanninger
12473583a5 doc expansions: mention the advantage of %exp{} over doubly quoted strings
The other advantage is that %exp{} is seamlessly nestable; I guess
that one is kind of implied by the context.
2024-11-04 07:15:34 +11:00
Johannes Altmanninger
f3f7d10eac Remove leftover file from system test 2024-11-04 07:15:34 +11:00
Johannes Altmanninger
6b9291104b Fix backward regex search ending in DOTALL
I noticed that reverse searches ending in "." stopped working in
version 2024.05.08:

	kak -n -e "exec %{%cfoobar<ret><esc>gj<a-/>foo.<ret>}'

Bisects ca7471c25 (Compute StartDesc with an offset to effective start,
2024-03-18) which updated the find_next_start() logic for the forward
case but not for backward case.  Add a symmetrical change and test
case, that seems to fix it. Not 100% sure if this is correct but
feels so.
2024-11-04 07:15:34 +11:00
Maxime Coste
60fcc3443e Change ui_out -until-grep to check for equality the next argument
Instead of outputing the matching output, either ignore the output
(if not extra argument is given) or match it.

Usage is: ui_out -until-grep <pattern> [<expected>]
2024-11-04 07:15:34 +11:00
Maxime Coste
be82047dbf Only check for ascii horizontal blanks during command parsing
The general is_horizontal_blank supports various unicode blanks,
but passing an utf8 continuation byte to it can lead to surprising
results as we can match with 0xA0 (when char is unsigned).

Fixes #5250
2024-10-28 12:21:09 +11:00
Maxime Coste
b96e500ddb Fork server to background on <c-z> if session is daemonized
Fixes #4957
2024-10-22 21:34:31 +11:00
Maxime Coste
7b18d5e1be Add missing test file 2024-10-22 21:26:11 +11:00
Maxime Coste
50917b39ca Remove now unused CompletionFlags
Since shell-script-completions now runs the script asynchronously
and unconditionally, there is no use for the CompletionFlags::Fast
anymore which means we can remove that type altogether.
2024-10-22 21:18:23 +11:00
Maxime Coste
ca7bc55cf5 Run shell-script-completions asynchronously
Share most logic with shell-script-candidates. Now that we do not
block we can run the completion script implicitely instead of waiting
for an explicit completion request with <tab>.

Fixes #5245
2024-10-22 21:18:23 +11:00
Maxime Coste
63ccc61c1d Merge branch 'readme' of https://github.com/hadronized/kakoune 2024-10-22 08:20:19 +11:00
Maxime Coste
ea756d5971 Merge remote-tracking branch 'yoshiyoshyosh/spell' 2024-10-22 08:19:30 +11:00
Maxime Coste
ac0db62181 Merge remote-tracking branch 'VeeDeltaVee/make-dir-fix' 2024-10-22 08:18:21 +11:00
Maxime Coste
81bfef94fa Merge remote-tracking branch 'mixi/install-fix' 2024-10-22 08:17:21 +11:00
Johannes Altmanninger
063c35222b rc ctags: remove obsolete -markup switch
menu no longer supports the -markup switch since 1f1152983 (rc
tools menu: replace menu builtin with a prompt-based implementation,
2023-11-20). That commit removed all markup that ctags passes to menu
but didn't bother to remove -markup switch (because it's ignored).

Let's remove the switch to avoid the need for escaping "{".

Closes #5244
2024-10-22 08:15:59 +11:00
Johannes Nixdorf
eb74f7fcbf Require mandir to be create before installing the man pages
Otherwise parallel installation may fail with:

 cp -f doc/kak.1 $(DESTDIR)/usr/share/man/man1
 cp: cannot create regular file '$(DESTDIR)/usr/share/man/man1': No such file or directory
2024-10-19 13:37:50 +02:00
Johannes Nixdorf
c95034e5f1 Johannes Nixdorf 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-10-19 13:37:50 +02:00
Versha Dhankar
78c7c20d0e
Update README to point to root Makefile
In b05295, the project switched from a root Makefile that simply pointed
to the "real" Makefile in src/, and made the root Makefile contain all
the build logic.

However, the documentation wasn't updated to reflect this change. I'm
updating the README.asciidoc file to point to the new location of the
file, to avoid further confusion
2024-09-28 21:40:33 -07:00
Versha Dhankar
9e5ca1bb05
Versha Dhankar 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-09-28 21:20:27 -07:00
Dimitri Sabadie
7473d126ef
Make the client/architecture less confusing in the README.
Some people (i.e. in the Doom Emacs discord) mentioned being confused at that
X11 thing. The last commit that touched that line was in 2014, so I think
providing more up-to-date examples should remove any confusion.
2024-09-24 18:48:06 +02:00
yosh
1a2bf04f1b Rework spell-next and add spell-prev command
Take use of the fact that awk's FS already uses regex for splitting
to eliminate the usage of sub() within the actual awk program.
2024-09-22 23:37:04 -04:00
Passw
5e0f9a2ce0 add header file #incldue "format.hh" to fix building error about missing hex(...) function 2024-09-19 18:56:29 +08:00
Johannes Altmanninger
0e225db00e rc git: don't require client in git show-diff
This fails because the new logic wrongly assumes the presence of a client:

    hook global WinCreate /.* 'git show-diff'

The "diff" process hangs because we never write to ${kak_response_fifo}.
After a "pkill diff", the *debug* buffer shows

    error while waiting for shell: 1:1: 'evaluate-commands': 3:13: 'execute-keys': no such client: '-draft'
    shell stderr: <<<

The client argument is completely unnecessary since we always want
to use the calling context's buffer anyway. Remove it.

Note that we can probably further simplify this by using "write"
instead of a shell process. I'll send that patch along a few other
error handling improvements later.

Closes #5235
2024-09-18 20:52:44 +01:00
Johannes Altmanninger
4b71eedbae rc git: fix show-diff and apply for BSD sed 2024-09-18 20:52:44 +01:00
Chris Webb
b4b3ddae0d Avoid stdin as a function parameter name
9275d96 introduces a use of stdin as a function parameter name, but POSIX
allows stdin to be a macro, which will conflict with this. This breaks
the build on musl systems.

Rename in the same way as the previous fix for this in c7d887d.
2024-09-17 13:37:54 +01:00
Maxime Coste
2e1e15106e Rename Window::display_position to display_coord 2024-09-16 07:39:21 +01:00
Maxime Coste
88fa43988a Do not return beginning of buffer whenever display to buffer coord fails
Use an empty Optional to show that resolution failed and just do not
do anything in the mouse event handler in that case.
2024-09-16 07:25:02 +01:00
Maxime Coste
daa7e37ed1 Merge remote-tracking branch 'sjjf/sql_filetype_misdetection' 2024-09-16 15:40:54 +10:00
Johannes Altmanninger
b0e21a150e Fix "git blame" inside "git blame-jump" diff buffers
I used to use a patch that removes cd_bufdir so I didn't notice this
being broken for *git* buffers.
2024-09-16 15:24:20 +10:00
Johannes Altmanninger
54992c08ae rc git: teach "git apply" to work on content, not just diffs
Staging/unstaging/reverting (parts of) the current buffer's file can
be a common use case.

Today "git apply" can do that based on a selection within a diff.
When the selection is on uncommitted content, we can probably assume
that the intent is to use the part of the selection that overlaps
with the +-side of "git diff" (or "git diff --cached" for
"git apply --cached").

Make "git apply" treat selections as content if the buffile is
tracked by Git. This differentiator is not perfect but I don't know
why anyone would want to use the existing "git apply" semantics on
a tracked file. Maybe we should pick a different name.

This feature couples well with "git show-diff", which shows all
lines with unstaged changes (in future it should probably show staged
changes as well).

Whereas on diffs, "git apply" stages the entire hunk if the selection
contains no newline, this does not happen when operating on content.
I didn't yet try implementing that.  I guess the hunks are not as
explicit here.

Closes #5225
2024-09-16 15:23:18 +10:00
Johannes Altmanninger
aac32e0f5a patch-range.pl: extract peculiarities
We pipe the output of the patch program to stderr (to have it show
up in *debug*) and print to stdout the remaining diff (the part of
the diff that was not passed to patch).

The next patch wants to use this script in a different way, so move
these decisions up.
2024-09-16 15:23:18 +10:00
Johannes Altmanninger
4f5001b4d3 diff-parse.pl: don't force error message into register
A following patch wants to use this script without wrapping it in an
"evaluate-commands -save-regs e %{ ... }", so simply print the raw
error message and set the register to the caller.

This interface is a bit weird because the error is printed quoted
but for now that just makes things a bit more convenient.
2024-09-16 15:23:18 +10:00
Johannes Altmanninger
ed4729a265 rc git: show-diff to honor unsaved buffer modifications
If a file has unsaved modifications, then the show-diff flags below
such modifications will be wrong.  Fix this by using the current
buffer contents, just like the git blame integration does.
This might make it a bit slower, I haven't tested that.
2024-09-16 15:23:18 +10:00
Johannes Altmanninger
314e69fc37 rc git: rationalize blame fifo usage
We call git blame
a. asynchronously in ":git blame"
b. synchronously in ":git blame-jump"

In both cases we
1. create a fifo
2. buffer the file contents in shell memory
3. print to the fifo
4. run git blame and remove the fifo

For the synchronous case the buffering and custom fifo is not
necessary; use ${kak_response_fifo} instead.

For the asynchronous case we do need a buffer that outlives the
enclosing %sh{} block. Buffering in shell memory can be somewhat slow
for large files.  Let's use a temporary file instead.
2024-09-16 15:23:18 +10:00
Johannes Altmanninger
fab8a7ef3c rc git: simplify git diff invocation
If stdout is not a TTY, Git never calls a pager, so this is
unnecessary.
2024-09-16 15:23:18 +10:00
Johannes Altmanninger
c93705b4cc rc filetype diff: diff-jump to use location at main selection, not the last one
The jump command does the same.
2024-09-16 15:23:18 +10:00
yosh
4f9020aa0e yosh 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-09-09 20:24:50 -04:00
Maxime Coste
be5f059f26 Merge remote-tracking branch 'arrufat/patch-1' 2024-09-09 19:57:45 +10:00
Maxime Coste
fce4c05e37 Merge remote-tracking branch 'arrufat/zig-builtins' 2024-09-09 19:57:27 +10:00
Maxime Coste
040f683ca6 Remove out-of-date documentation about <esc> ending macro recording
Fixes #5223
2024-09-08 22:01:14 +10:00
Maxime Coste
7e05dc8d2e Add terminal_title terminal ui_option to control the title
Use a separate option from terminal_set_title for simplicity.

Fixes #2217
Closes #4265
2024-09-08 21:59:27 +10:00
Adrià Arrufat
0c47774bd6 Add new Zig builtins 2024-09-06 10:29:38 +09:00
Adrià
c0118f2fba
Remove trailing space in scopes.asciidoc
Closes #5226
2024-09-05 16:06:26 +09:00
Maxime Coste
c1ce1d7014 Explicitely call try_accept on InsertCompleter
Calling it as part of the insert method was error prone and often
led to slightly surprising behaviour, such as the <c-r><esc> hiding
the menu on <esc>.
2024-09-02 20:35:07 +10:00