Commit Graph

10086 Commits

Author SHA1 Message Date
Bob Qi
f33126c2a9 give up to wrap command into a shell to avoid conflict with connect.kak 2023-02-22 15:57:22 +08:00
Bob Qi
8aa144a548 Bob Qi 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-02-22 13:17:04 +08:00
Bob
4ff5de6273 Create zellij.kak 2023-02-22 13:17:04 +08:00
Maxime Coste
fa060c2a17 Fix fatal exception when checking if buffer needs to be reloaded
If, for example, the buffer path now is a directory, MappedFile will
throw on construction. Using a try block to explicitely allow errors
fixes the issue.
2023-02-21 16:59:16 +11:00
Maxime Coste
be49f36205 Only decode current codepoint once per step
Instead of potentially decoding for each thread, always decode as
its only slightly slower than finding next codepoint (which will
be necessary anyway) and pass the codepoint to each thread.
2023-02-19 12:15:33 +11:00
Maxime Coste
2b74cd4b59 Remove instructions from ExecConfig
We can just compute whenever we reset last_step, which does not happen
often and we know `forward` at compile time anyway
2023-02-19 11:46:17 +11:00
Maxime Coste
f115af7a57 Optimize Regex CharacterClass matching
Take advantage of ranges sorting to early out, make the logic
inline.
2023-02-19 11:16:14 +11:00
Johannes Altmanninger
213ea922b1 Complete arguments to "echo -to-file"
Including this here because grandparent parent commit broke completions
for "edit -fifo".
2023-02-17 20:50:58 +01:00
Johannes Altmanninger
9e0502a1ca Do not complete redundant switches 2023-02-17 20:50:58 +01:00
Johannes Altmanninger
64d4d29d43 Use parameter parser to skip switch args in completion
The command line "hook -group xyz " should get scope completions but
it actually gets hook completions because "xyz" is wrongly interpreted
as positional argument.

Fix this by using the parameters parser to compute positional
arguments.

Fixes #4840
2023-02-17 20:50:58 +01:00
Ameer Ghani
6acc18373d Add option to set maximum info box width
Some plugins (*cough* kak-lsp) and help texts tend to have immensely long content
in a single line. This generates info boxes that span the entire terminal width.
This is made especially worse on widescreen monitors or at small text size.

This grants user control over how wide these boxes are.

I deliberately avoid pushing this change to `kak-lsp` because it's not the only
plugin that this could help--see the `hook` help text for an example of this
problem in vanilla Kakoune. I would also suggest that since this is a rendering
concern, it be handled by the terminal rendering logic.
2023-02-15 21:17:22 -05:00
Maxime Coste
afaa47e93f Fix trimming of line front halfway through a double-width glyph
Insert a space to replace the half glyph and ensure the rest of the
line is correctly aligned.

Fixes #4843
2023-02-15 13:04:53 +11:00
Maxime Coste
0630b4f4f6 Fix scroll_window not ensuring cursor lies on a codepoint start
Fixes #4839
2023-02-14 22:00:12 +11:00
Maxime Coste
458e3ef20a Immediately execute ModuleLoaded hooks for already loaded modules
This is trickier than expected because ModuleLoaded hooks can (as
any other hooks) use arbitrary regular expressions for their filter.

Fixes #4841
2023-02-14 21:31:29 +11:00
Maxime Coste
85ceef29bd Fix broken corner cases in DualThreadStack::grow_ifn
We only grow when the ring buffer is full, which allows for a nice
simplification of the code.

Tell grow_ifn if we pushed in current or next so that we can
distinguish between filled by next or filled by current when
m_current == m_next_begin
2023-02-14 17:13:31 +11:00
Maxime Coste
d708b77186 Refactor DualThreadStack as a RingBuffer
Instead of two stacks growing from the two ends of a buffer, use
a ring buffer growing from the same mid spot.

This avoids the costly memory copy every step when we set next
threads as the current ones.
2023-02-14 07:04:54 +11:00
Maxime Coste
762064dc68 Remove scheduled optimization from ThreadedRegexVM
This does not seem to actually speed up execution as threads will
be dropped on next step anyway
2023-02-13 21:15:55 +11:00
Maxime Coste
3150e9b3cd Avoid extra indirection for storing FifoWatcher
By improving the Value interface we can avoid storing a unique_ptr
to a FifoWatcher and directly store the FifoWatcher.
2023-02-10 12:56:32 +11:00
Maxime Coste
eb0e983133 Fix DisplayLine::trim_front quadratic behaviour
Erasing fully trimmed display atoms one by one means we have to
shift all the remaining ones every time. This is wasteful and we
can just erase all the fully trimmed atom in one go.

Fixes #4797
2023-02-03 11:31:13 +11:00
Maxime Coste
9257beac88 Merge remote-tracking branch 'az5112/vimtokak' 2023-01-28 08:31:49 +11:00
Maxime Coste
d5ae08498c Merge remote-tracking branch 'krobelus/selection-undo-fix-standstill-after-buffer-change' 2023-01-28 08:29:41 +11:00
Maxime Coste
6b7ed51be1 Merge branch 'hare-packed' of http://github.com/stacyharper/kakoune 2023-01-27 11:26:17 +11:00
Maxime Coste
f4730eaa29 Merge branch 'master' of http://github.com/Awesomerly/kakoune 2023-01-27 10:59:05 +11:00
Maxime Coste
37b160e935 Merge remote-tracking branch 'occivink/fix-split-stray-sel' 2023-01-27 10:58:38 +11:00
Maxime Coste
9763ce4fe9 Merge remote-tracking branch 'razetime/master' 2023-01-27 10:58:32 +11:00
Eve
7831ab8f9d Fix typo in options.asciidoc 2023-01-23 09:11:30 -05:00
Eve
5df614330d Remove mention of in README 2023-01-23 09:09:36 -05:00
Maxime Coste
5097884608 Fix crash in TabulationHighlighter when wrapping just after a tab 2023-01-23 17:39:40 +11:00
Maxime Coste
f5d5274c5f Fix incorrect use of subject end/begin in regex execution
This could lead to reading past subject string end in certain
conditions

Fixes #4794
2023-01-23 17:38:02 +11:00
Maxime Coste
a02bd19533 Revert "Remove compare include that seems to break clang"
Looks clang breaks differently when this is not included

This reverts commit 7030b3c47c.
2023-01-21 11:27:05 +11:00
Maxime Coste
702358b559 Replace std::strong_ordering with auto return type to not require <compare> 2023-01-21 11:19:39 +11:00
Maxime Coste
c0be723444 Try to fix cirrus macos tests 2023-01-21 11:11:07 +11:00
Maxime Coste
7030b3c47c Remove compare include that seems to break clang 2023-01-21 11:06:22 +11:00
Olivier Perret
b039a313a4 fix 'split' operation when the pattern occurs at the beginning
Previously it would result in a stray single-character selection at the
beginning of the input text.

For example:
[abcabc] -> split on 'a' -> [a][bc]a[bc]
or
[foobarfoobar] -> split on 'foo' -> [f]oo[bar]foo[bar]

Note that this behavior was not occuring if the input text was at the
beginning of the buffer
2023-01-20 18:05:04 +01:00
Maxime Coste
d8883d47c0 Merge remote-tracking branch 'krobelus/fix-mouse-click-during-insert' 2023-01-18 07:48:37 +11:00
Maxime Coste
029b28a85c Merge remote-tracking branch 'potatoalienof13/fix-buffer-advance' 2023-01-18 07:47:23 +11:00
Maxime Coste
247e4885e8 Merge remote-tracking branch 'm-kru/troff_headings_highlighting' 2023-01-18 07:46:36 +11:00
Maxime Coste
a5f8572fe4 Merge remote-tracking branch 'arrufat/git-add-reset-docstring' 2023-01-18 07:41:02 +11:00
Maxime Coste
f720ded96a Merge remote-tracking branch 'krobelus/missing-error-when-open-fails' 2023-01-18 07:40:35 +11:00
razetime
b794855c70 add APL highlighting 2023-01-14 11:04:16 +05:30
razetime
6af78e0f9f Razetime 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-01-14 11:03:52 +05:30
Johannes Altmanninger
4f7d7a5e33 Fix regression when file on command line cannot be opened
Commit 933e4a599 (Load buffer in command line order, 2022-12-06)
introduced a regression: the command

	$ kak /boot/grub/grub.cfg
	Fatal error: no such buffer '/boot/grub/grub.cfg'

quits with no indication of the underlying error.

Prior to 933e4a599, it would open the *scratch* buffer instead,
and show an error in the status line, pointing to the debug buffer,
which would contain:

	error while opening file '/boot/grub/grub.cfg':
	    /boot/grub/grub.cfg: Permission denied

Let's fix this scenario by matching the old behavior.
2023-01-08 17:26:15 +01:00
Johannes Altmanninger
35f23d6fad Remove bogus assertions preventing mouse clicks in insert mode
Recent changes for selection-undo added an assertion that triggers
when a mouse-drag overlaps with an insert mode, because both events
record selection history.  However this is actually fine.  The one
that finishes last concludes the selection edition, while the other
one will be a nop.

The test could be simpler (i.e. not require sleeps) but I figured it
doesn't hurt add this since we don't have any comparable tests.
2023-01-08 10:47:36 +01:00
Adrià Arrufat
f92df3ec96 Add reset to git command docstring 2023-01-06 00:17:38 +09:00
Stacy Harper
8c4b591a9e
Add @packed to hare highlighter
ref: https://todo.sr.ht/~sircmpwn/hare/783
2023-01-02 20:38:12 +01:00
Michał Kruszewski
dddadce7e8 troff filetype: Fix headings highlighting 2022-12-30 21:45:17 +01:00
Johannes Altmanninger
516759bb2f Make selection undo skip over entries that are nop after buffer change
After buffer modification - in particular after deletion - adjacent
selection history entries may correspond to the same effective
selection when applied to the current buffer. This means that we
sometimes need to press <c-h> multiple times to make one visible
change. This is not what the user expects, so let's keep walking the
selection history until we hit an actual change.

Alternatively, we could minimize the selection history after buffer
changes but I think that would make the it worse after content
undo+redo.
2022-12-27 18:24:55 +01:00
Johannes Altmanninger
8427379a5d Tweak selection-undo interaction with WinDisplay hooks
Each selection undo operation is surrounded by pair of
begin_edition()/end_edition() calls.
The original reason for adding these was that in one of my preliminary
versions, a WinDisplay hook could break an undo chain, even if the
hook did not affect selections at all. This has since been fixed.

By surrounding the undo with begin_edition()/end_edition(), try to
ensure that any selection modification that happens in a WinDisplay
hook would not break the undo chain. Essentially this means that,
after using <c-h> to undo a buffer change, this was meant to
make sure that <c-k> could redo that buffer change.

However, it turns out this actually doesn't work.  The attached test
case triggers an assertion.  As described in the first paragraph,
the only real-world motivation for this is gone, so let's simplify
the behavior.
The assertion fix means that we can test the next commit better.
2022-12-27 18:24:55 +01:00
Johannes Altmanninger
8e8c2fb46d Add tests for selection undo 2022-12-27 18:24:55 +01:00
Johannes Altmanninger
016e1be77f Extract variable and add comment in selection change recording
No functional change.
2022-12-27 18:24:55 +01:00