Commit Graph

5804 Commits

Author SHA1 Message Date
Johannes Altmanninger
22b1d4ec4a Try to fix crash due to fifo read regression
I saw a crash when running

	git log --oneline %arg{@}
	hook -once buffer NormalIdle .* %{
		execute-keys -draft \
		%{gk!} \
		%{git diff --quiet || echo "Unstaged changes";} \
		%{git diff --quiet --cached || echo "Staged changes";} \
		<ret>
	}

Backtrace (I still have GDB attached):

    #4  0x00006502c740b13f in Kakoune::operator- (rhs=..., lhs=...) at /home/johannes/git/kakoune/src/units.hh:33
    33	   { return RealType(lhs.m_value - rhs.m_value); }
    (gdb) up
    #5  Kakoune::Buffer::next (coord=..., this=0x6502c90d7ff0) at /home/johannes/git/kakoune/src/buffer.inl.hh:18
    18	   if (coord.column < m_lines[coord.line].length() - 1)
    (gdb) up
    #6  FifoWatcher::read_fifo (this=0x6502c90d9e48) at buffer_utils.cc:252
    252	                           m_buffer.erase(pos, m_buffer.next(pos));

This was introduced in 582c3c56b (Do not add trailing newline to
non-scrolling fifo buffers, 2024-01-28).

The problem seems to be that we call "m_buffer.next()" on a position
that is past-end the buffer, so m_lines[coord.line] is out-of-bounds.
Fix it.
For some reason I have not managed to reproduce the crash, not even
with sanitize=address.

There might be another problem: m_had_trailing_newline is intentionally
uninitialized because it is supposed to be read only on the second
read() with a positive return value. Unfortunately I think it's
possible that e.g. a NormalIdle hook inserts some text before the
first positive read(). Then, this line

        const bool is_first = pos == BufferCoord{0,0};
        if (not m_scroll and (is_first or m_had_trailing_newline))
            pos = m_buffer.next(pos);

will read uninitialized "m_had_trailing_newline".  Fix that too, to
be on the safe side. Sadly I don't have a test for this one either
so I'm not sure.
2024-02-18 10:14:17 +11:00
Maxime Coste
4101e18144 Early reject regex instructions that were already scheduled this step 2024-02-12 08:08:16 +11:00
Maxime Coste
e0c7a34bc1 Use unicode is_word/to_{lower/upper} function in ranked match 2024-02-12 07:50:04 +11:00
Maxime Coste
bd91a255e4 Do not decode utf8 while looking for next regex match start candidate
If the first byte in the multi-byte utf8 sequence does not match,
it means the "other" character is not set, so none of the sequence
byte will match (as they are all with the MSB set). This tightens
the critical loop which ends up running faster in most cases.
2024-02-11 12:17:21 +11:00
Maxime Coste
cf95043b14 Merge remote-tracking branch 'krobelus/changelog' 2024-02-10 21:55:09 +11:00
Maxime Coste
3ef68188b4 Avoid iswlower, iswupper, towlower and towupper for ascii codepoints
Avoid the costly shared object function call when most codepoints
will be ascii.

The regex benchmark gets a nice speedup:

Regex                                   Before     After
--------------------------------------+----------+---------
'Twain'                               |    25 ms | 15 ms
'(?i)Twain'                           |    74 ms | 57 ms
'[a-z]shing'                          |   323 ms | 303 ms
'Huck[a-zA-Z]+|Saw[a-zA-Z]+'          |    26 ms | 17 ms
'\b\w+nn\b'                           |   424 ms | 393 ms
'[a-q][^u-z]{13}x'                    |   869 ms | 815 ms
'Tom|Sawyer|Huckleberry|Finn'         |    33 ms | 24 ms
'(?i)Tom|Sawyer|Huckleberry|Finn'     |   319 ms | 281 ms
'.{0,2}(Tom|Sawyer|Huckleberry|Finn)' |  1294 ms | 1293 ms
'.{2,4}(Tom|Sawyer|Huckleberry|Finn)' |  1470 ms | 1429 ms
'Tom.{10,25}river|river.{10,25}Tom'   |    69 ms | 61 ms
'[a-zA-Z]+ing'                        |   447 ms | 408 ms
'\s[a-zA-Z]{0,12}ing\s'               |   539 ms | 543 ms
'([A-Za-z]awyer|[A-Za-z]inn)\s'       |   588 ms | 552 ms
'["'][^"']{0,30}[?!\.]["']'           |    92 ms | 81 ms
2024-02-06 22:16:08 +11:00
Maxime Coste
04a96b059f Use different hash algorithms for strings and file hashing
For hash map, using fnv1a is faster as it is a much simpler algorithm
we can afford to inline. For files murmur3 should win as it processes
bytes 4 by 4.
2024-02-06 21:57:17 +11:00
Maxime Coste
707904a91b Avoid calling iswalnum for ascii characters
iswalnum can be pretty expensive as its a shared library call.
2024-02-06 20:47:59 +11:00
Johannes Altmanninger
7cea09d327 Changelog entries for new blame features 2024-02-05 21:42:02 +11:00
Johannes Altmanninger
582c3c56b2 Do not add trailing newline to non-scrolling fifo buffers
Internally, all lines have a trailing "\n".
Buffers created empty (like fifo buffers) start with a single line.

When reading data into fifo buffers, we insert *before* the last line's
trailing newline ("last newline").  This enables autoscrolling (enabled
with "edit -scroll") as long as the cursor is on the last newline.

When autoscrolling is disabled, we have a special case to insert
*after* the last newline.  This means that a cursor on that newline
won't be moved.  Then we transplant the newline character from the
beginning to the end of the buffer. This special case happens only on
the very first fifo read; on subsequent reads, the cursor at position
1.1 will not be moved anway because insertions happen below 1.1.

Since we always insert (effectively) before the last newline, fifo
buffers have a trailing empty line.

For autoscrolling buffers this seems correct; it gives users an
obvious way to toggle autoscrolling.

For non-scrolling buffers the newline is redundant.  Remove it.
This requires keeping track of whether the last newline comes from
the fifo, or was added by us.  The shortest fix I could find
is to always append to the buffer if not scrolling, and then delete
the added newline character if applicable.

    m_buffer.insert(m_scroll ? pos : m_buffer.next(pos), StringView(data, data+count));
    if (not m_scroll and not m_had_trailing_newline)
        m_buffer.erase(pos, m_buffer.next(pos));

maybe that's the best fix overall; but erasing at the end seems better
than erasing in the middle, so do that whenever possible.

Reported in https://lists.sr.ht/~mawww/kakoune/%3CZbTK7qit9nzvrMkx@gmail.com%3E
2024-01-30 08:24:27 +11:00
Maxime Coste
c124c8f517 Support -after switch for flag-lines highlighter 2024-01-30 08:20:13 +11:00
Maxime Coste
5ea5c99c58 Fix using invalid strings for undo content strings
The code was wrongly using the write_it instead of the read_it to
access the removed lines content.

Fixes #5088
2024-01-21 10:24:08 +11:00
Johannes Altmanninger
20b0eadfc8 Don't modify prompt history when validating empty input
Fixes #5076
2024-01-15 15:08:10 +01:00
Maxime Coste
43e8aadcaa Fix performance of diff-based reloading of buffers
It turns out diffing was pretty fast, but applying the diff was
sub-optimal as it was constantly inserting/erasing lines which
led to lots of unnecessary shifting. Fix this by manually tracking
a read/write iterator and only shifting when necessary (on keeps,
and inserts).
2023-12-26 21:21:01 +11:00
Maxime Coste
68e73d8a24 Take eq predicate by reference in for_each_diff 2023-12-26 21:21:01 +11:00
Maxime Coste
3c81a4a253 Small code style tweak 2023-12-26 18:49:16 +11:00
Maxime Coste
ba7059a2dc Fix wrong name 2023-12-26 18:09:25 +11:00
Johannes Altmanninger
556c7633ba Update changelog 2023-12-16 12:19:09 +01:00
Maxime Coste
533f51c744 Merge remote-tracking branch 'krobelus/prefer-input-order-over-alphabet' 2023-12-12 21:27:31 +11:00
Maxime Coste
96b74d1ad6 Merge remote-tracking branch 'arachsys/hide-unmapped' 2023-12-12 21:24:47 +11:00
Maxime Coste
065e0229a9 Fix stray semicolon 2023-12-12 21:23:57 +11:00
Maxime Coste
5ed2433b9f Merge remote-tracking branch 'arachsys/unsigned-char' 2023-12-12 21:19:52 +11:00
Chris Webb
a8d5b8bd2c Fix compiler warnings when char is unsigned
In several places, we check for a control character with something like

  char c;
  [...]
  if (c >= 0 and c <= 0x1F)
    [...]

When char is signed (e.g. amd64) this is fine, but when char is unsigned
by default (e.g. arm32 and arm64) this generates warnings about the
tautologous check that an unsigned value is non-negative.

Write as

  if ((unsigned char) c <= 0x1F)
    [...]

which is both correct and not suspicious under both conventions.
2023-12-10 11:09:55 +00:00
Chris Webb
7b2772ef89 Change use of deprecated '->' operator on an iterator
In display_buffer.hh, the '->' operator is used on an iterator, but
(surprisingly) this is deprecated from C++20 because of x-value vs
l-value ambiguity. Now clang's -Wdeprecated-declarations warns about it
as we declare -std=c++2a. See

  https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1252r2.pdf

which was adopted for 2019-03.
2023-12-10 10:58:42 +00:00
Chris Webb
ee8c74c724 Add -Wno-stringop-overflow for g++
g++ 13.x is confused by the reinterpret_cast in Kakoune's memory.hh
allocator. Use -Wno-stringop-overflow to silence a large number of
verbose false alarms.
2023-12-10 10:26:37 +00:00
Chris Webb
a90d1d33f7 Mark refresh_ifn() implementation as an override in input_handler.cc
This was spotted by clang's -Winconsistent-missing-override in -Wall.
2023-12-10 09:58:40 +00:00
Chris Webb
7af2b99317 Hide empty and undocumented mappings from autoinfo
Users who rebind default keys and unmap the originals by binding them
to empty strings with empty docstrings end up with empty lines in the
autoinfo. For example, https://github.com/mawww/kakoune/issues/4918.

Hide completely null bindings which have both an empty mapping and an
empty docstring in the autoinfo, as an easy mechanism for these users to
eliminate the UI noise.

Fixes https://github.com/mawww/kakoune/issues/4918
2023-12-06 17:35:46 +00:00
Maxime Coste
7f49395cf9 Fix basename prefix flag to use smartcase eq 2023-12-04 19:22:32 +11:00
Johannes Altmanninger
658c3385a9 ranked match: prefer input order over alphabetical order for user-specified completions
When using either of

	set-option g completers option=my_option
	prompt -shell-script-candidates ...

While the search text is empty, the completions will be sorted
alphabetically.
This is bad because it means the most important entries are not listed
first, making them harder to select or even spot.

Let's apply input order before resorting to sorting alphabetically.

In theory there is a more elegant solution: sort candidates (except
if they're user input) before passing them to RankedMatch, and then
always use stable sort. However that doesn't work because we use a
heap which doesn't support stable sort.

Closes #1709, #4813
2023-12-02 10:43:59 +01:00
Johannes Altmanninger
d6215dc25d Reuse for_n_best when sorting values from complete options
While at it, remove a needless reserve() call and reserve an extra slot
because "InsertCompleter::try_complete" might add one more element.
2023-12-02 09:57:15 +01:00
Maxime Coste
94d58b2e07 Merge remote-tracking branch 'sidkshatriya/escape-curly-bracket' 2023-12-02 11:03:56 +11:00
Maxime Coste
c93c57a46f Merge remote-tracking branch 'krobelus/fuzzy-menu' 2023-12-02 10:56:29 +11:00
Maxime Coste
42fefb16af Merge remote-tracking branch 'arachsys/write-replace' 2023-12-02 10:56:11 +11:00
Maxime Coste
215aa0b2fb Fix single word detection when query is not single word 2023-12-02 10:39:23 +11:00
Chris Webb
3ba3399f94 Set replacement file permissions before moving into place
When doing :write -method replace, make sure we've set the correct mode,
uid and gid on the replacement file before attempting to rename it on
top of the original. This means that the original file is left in place
with correct permissions if anything fails, rather than ending up with
0700 permissions from mkstemp().
2023-11-28 08:51:32 +00:00
Chris Webb
d3af9b57d4 Restore file ownership when editing with root privilege
When a privileged :write is used with -method replace, it silently resets
the ownership of files to root:root. Restore the original owner and group
in the same way we restore the original permissions. Ownership needs to
be restored before permissions to avoid setuid and setgid bits being set
while the file is still owned by root, and to avoid them being subsequently
lost again on chmod(2).
2023-11-26 18:12:52 +00:00
Chris Webb
05bbdb27c9 Fix crash when ':write -method replace' fails to create tempfile
If a user attempts to save a file without write permission for the
containing directory, with writemethod set as 'replace' or an explicit
':write -method replace' command, kak crashes with "terminating due to
uncaught exception of type Kakoune:runtime_error". (Note this doesn't
happen with a forced write, which fails earlier when it tries to enable
u+w permission.)

Don't raise another exception when already bailing out with a runtime
error for failing to create a temporary file or open the existing file.
Instead, make a best-efforts attempt to restore the file permissions
before raising the first exception, and only report the runtime chmod
exception if that step fails on the non-error path.
2023-11-26 17:50:32 +00:00
Chris Webb
32680e5d65 Skip output synchronization query when explicitly disabled
Some terminals misbehave when queried for output synchronization support,
such as Windows Terminal as reported in

  https://github.com/mawww/kakoune/issues/5032

The relatively long response from a terminal which does support output-sync
is also prone to getting torn over a slow link such as a serial console,
causing stray input to the editor.

In ui_options, the terminal_synchronized option controls the use of this
feature, but unfortunately the query is unconditionally sent at startup
even when this is set false.

Skip the query at startup when terminal_synchronized is explicitly false.

We query at most once per terminal in set_ui_options so the behaviour
is correct both when kakoune is started with terminal_synchronized unset
and when it is started with terminal_synchronized set false but this is
later unset.
2023-11-24 12:55:45 +00:00
Maxime Coste
990e92a5f3 Only set Prefix in RankedMatch if the full query matches 2023-11-23 17:16:24 +11:00
Maxime Coste
ac7b498c86 Merge remote-tracking branch 'krobelus/changelog' 2023-11-21 21:04:18 +11:00
Maxime Coste
5e4e23289b Fix completion menu not getting hidden on no matches 2023-11-21 17:16:38 +11:00
Johannes Altmanninger
1f11529837 rc tools menu: replace menu builtin with a prompt-based implementation
prompt has fuzzy filtering which is more discoverable than the menu
mode's regex filtering (because that one needs / to trigger it).
There are no important differences left, so replace the menu builtin
with a prompt-based command.

prompt does not support markup in the completion menu, so drop that
feature for now.
2023-11-20 20:47:22 +01:00
Johannes Altmanninger
4499b26ca4 Fix use after move in HashMap::insert
Apparently GCC builds worked fine but Clang builds started failing the
"(hash == hash_value(item_key(item)))" assertion.
2023-11-18 19:07:23 +01:00
Johannes Altmanninger
0bb5b28f7e Update changelog 2023-11-17 19:41:55 +01:00
Maxime Coste
296ab1a1ff Improve WordDB performance by precomputing hashes
Avoid multiple computation of string hashes by making it possible
to pre-compute and pass hashes to interned strings and hash maps.
2023-11-17 17:01:51 +11:00
Sidharth Kshatriya
be7e3ccc9e changelog: escape { as \\{ otherwise '%val{window_range}' appears as '%val' in version notes startup splash 2023-11-17 03:19:14 +05:30
Maxime Coste
b10a935b8c Drop last character for basename matching
If the candidate ends with a slash we still look at the previous
component as the basename.
2023-11-16 12:59:55 +11:00
Maxime Coste
a42aa1e47e Slight cleanup of RankedMatch code 2023-11-15 12:48:23 +11:00
Maxime Coste
1cfe5273f3 Do not use range adaptor to gather ranked matches
This ends up constructing RankedMatch twice, once when computing
the number of elements then once when actually filling the vector.
2023-11-15 12:46:28 +11:00
Maxime Coste
4a1a3ee06e Refactor fuzzy matcher ranking further
Remove FirstCharMatch which does not impact any of the test cases
and explicitely detect paths by using a BaseName flag when we match
the basename of the path.
2023-11-15 12:27:48 +11:00
Maxime Coste
11f0ace9b6 Make shell-script-candidates completer run in the background
Read output from the script as it comes and update the candidate
list progressively.

Disable updating of the list when a completion has been explicitely
selected.
2023-11-14 21:39:03 +11:00
Maxime Coste
719512b308 Use a separate copy of the command completer for each completion
This make the completer lifetime tied to the Prompt mode and removes
the need for the Start flag. It also makes it possible to cleanup
on completer destruction.
2023-11-14 21:39:03 +11:00
Maxime Coste
79f3f5b046 Merge remote-tracking branch 'krobelus/quote-regex-option-value-completions' 2023-11-14 21:38:26 +11:00
Johannes Altmanninger
cac2a32ba2 Fix completion pager not rendering after <a-semicolon> in prompt
Usually, the prompt resets "m_line_changed" after invoking the
change handler:

	if (m_line_changed)
	{
	    m_callback(m_line_editor.line(), PromptEvent::Change, context());
	    m_line_changed = false;
	}

but with

	prompt '' '' -on-change %{ execute-keys <a-semicolon>vl } -shell-script-candidates %{ seq 100 }

the change handler pushes a normal mode with "<a-semicolon>" and then
hands back control to the event loop. Later when the normal mode is
popped we run "Prompt::on_enabled()" but don't actually redraw the
completion pager.
Since the <a-semicolon> excursion by definition did not change our
prompt state, we don't need to recompute completions, only render them.
Do that.

This helps commands that use preview the selected completion via a
"prompt -on-change" handler.
2023-11-14 10:20:08 +01:00
Johannes Altmanninger
118459db59 Quote completions of regex options
Recent changes to `make_error_pattern` added a space to the default
value. This means that

	set g make_error_pattern <tab>

now produces an invalid command because regexes are not quoted.  We do
quote strings; regexes are not all that different so quote them too.
2023-11-13 23:42:39 +01:00
Johannes Altmanninger
70e96c272e Avoid unnecessary copy of completion candidates 2023-11-13 23:42:39 +01:00
Maxime Coste
ed1e2f2e08 Add missing include for std::array 2023-11-13 23:03:03 +11:00
Maxime Coste
c2fb0738d3 Merge remote-tracking branch 'krobelus/fix-noincsearch' 2023-11-13 22:56:06 +11:00
Maxime Coste
c7d887d9d1 Rename stdin/stdout/stderr in Shell a they conflicts with macros
Fixes #5023
2023-11-13 20:19:55 +11:00
Maxime Coste
fc7be678ed Change window_range to emit each element as a separate string 2023-11-13 19:22:33 +11:00
Johannes Altmanninger
c597a056d0 Fix spurious incremental search when incsearch=false
Regressed in a2c41593a (Fix partial regex text being pushed in history,
2023-11-02).
2023-11-11 14:37:32 +01:00
Maxime Coste
2261b48e35 Fix SingleWord handling in RankedMatch
subsequence_match_smart_case does not necessarily find the word,
but we then check for a contiguous match in which case, if the query
is a word, we also have a single word match.
2023-11-11 18:59:11 +11:00
Maxime Coste
c45a1d435a small code cleanup 2023-11-11 18:46:15 +11:00
Maxime Coste
fbbced5ed0 Support building ArrayView from contigous iterators 2023-11-10 16:35:46 +11:00
Maxime Coste
feeacd8de9 Refactor spawn_shell to return the relevant FDs
This removes the need for the setup_child callback which is quite
tricky as it cannot touch any memory due to vfork, and removes the
Pipe abstraction in favor of a more general UniqueFd one.
2023-11-05 22:47:17 +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
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
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
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
Maxime Coste
a2c41593aa Fix partial regex text being pushed in history 2023-11-02 13:00:12 +11: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
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
18902b15af Refactor regex_prompt logic and fix function being called on abort
Fixes #4993
2023-10-04 21:03:10 +11:00
Loric Brevet
a2fd401cfa
Add an InlineInformation face distinct from Information 2023-09-28 15:06:29 +02:00
Maxime Coste
23afed056b Add a daemonize-session command and refactor local client handling
Make it possible to move the current session to a daemon one after
the fact, which is useful to ensure the session state survives client
disconnecting, for example when working from ssh.
2023-09-26 17:50:56 +10:00
Maxime Coste
3bf16c0fb1 Merge remote-tracking branch 'krobelus/foot-custom-keypad-sequences' 2023-09-23 21:31:01 +10:00
Chris Webb
9a0c7cea47 Fix quoting of arguments to kak -c SESSION
Filename arguments to kak -c SESSION are passed to the remote sessions
as commands like

  edit 'FILENAME';

but single-quotes in FILENAME are incorrectly escaped as \' instead of
being doubled-up. Fix this so kak -c SESSION "foo'bar" becomes

  edit 'foo''bar';

instead of

  edit 'foo\'bar';

Reported by @FlyingWombat in https://github.com/mawww/kakoune/issues/4980
2023-09-22 13:40:58 +01:00
Maxime Coste
871631bb00 Trigger auto completion refresh when necessary on completion select
This removes the timing dependent behaviour where `Tab` would only
display the completion menu if pressed before the prompt idle timeout

This means `exec :dc<tab>` now expands 'dc' to 'define-command'
instead of just showing the completion menu a few millis early.
2023-09-19 17:15:11 +10:00
Maxime Coste
541c385aa4 Revert "Do not make cursor visible on force redraw"
This unfortunately breaks the testing framework, more work
necessary before we can do that.

This reverts commit 9b1f4f5f20.
2023-09-08 05:54:32 +10:00
Maxime Coste
dd5b624003 Merge remote-tracking branch 'divarvel/show-trailing-whitespace' 2023-09-08 05:50:11 +10:00
Maxime Coste
9787756619 Use last display setup instead of recomputing for window_range
Fixes #4964
2023-09-08 05:24:56 +10:00
Maxime Coste
9b1f4f5f20 Do not make cursor visible on force redraw 2023-09-08 05:24:56 +10:00
Maxime Coste
20a2bca52e Do not make cursor visible after mouse scrolling and view commands
ensure cursor is visible after user input except if the command
implementation opted-out. Hooks and timers should not enforce
visible cursor.

PageUp/PageDown and `<c-f>` / `<c-b>` commands still move the cursor
as this seemed a desired behaviour.
2023-09-02 12:55:57 +10:00
Maxime Coste
6990270005 Still inkorrect inglish
Hopefully thats better now
2023-08-31 04:56:50 +10:00
Maxime Coste
a212fd25a0 Fix incorrect inglish 2023-08-29 03:24:27 +10:00
Maxime Coste
e4d7b884cd Cleanup SIGHUP handling and forking server to background
Ensure we ignore SIGHUP once the TerminalUI is gone as it will be
sent again on fork, fix the parent process terminating due to trying
to write to stdout after it was closed.

Fixes #4960
2023-08-27 08:47:33 +10:00
Maxime Coste
7e86230c61 Merge remote-tracking branch 'arachsys/create-default-region' 2023-08-27 08:11:07 +10:00
Maxime Coste
fe93a9df37 Remove Window::force_redraw()
This was mostly redundant with Client::force_redraw.
2023-08-27 08:03:42 +10:00
Maxime Coste
6f9f32b4bb Small code cleanup in winow.cc/hh 2023-08-27 07:01:50 +10:00
Maxime Coste
9c0c6b8fd5 Revert "Only make cursor visible after buffer or selection change"
This is currently broken on various corner cases and breaks the
"master branch should be good for day to day work" implicit rule,
ongoing work to stabilize this feature will take place on the
no-cursor-move-on-scroll branch until its deemed ready.

This reverts commit 1e38045d70.

Closes #4963
2023-08-23 14:13:22 +10:00
Maxime Coste
1e38045d70 Only make cursor visible after buffer or selection change
Kakoune now does not touch cursors when scrolling. It checks
if either the buffer or selections has been modified since
last redraw.

Fixes #4124
Fixes #2844
2023-08-16 21:02:42 +10:00