summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2023-03-14Cleanup and speed up test runnerMaxime Coste
Add a -end-of-line switch to echo command to make it possible to use `echo -end-of-line -to-file <file>` to collect env-vars
2023-03-14Convert \r to \n in bracketed pastesMaxime Coste
It seems many terminals emits \r for newlines in bracketed pastes, manually convert this.
2023-03-13Grow dual thread stack after pushing a thread on the next queueMaxime Coste
The previous code was assuming it was fine to push_next without growing, which used to be the case with the previous implementation because we always have poped the current thread that we try to push. However now that we use a ring-buffer, m_next_begin == m_next_end can either mean full, or empty. We solve this by assuming it means empty and never allowing the buffer to become full, which means we need to grow after pushing to next if we get full. Fixes #4859
2023-03-13Fix crash when pasting at buffer endMaxime Coste
Fixes #4844
2023-03-13Merge remote-tracking branch 'krobelus/perror-on-chmod-failure'Maxime Coste
2023-03-13Slight refactoring of bracketed paste featureMaxime Coste
Handle begin/end paste directly in paste csi, manage paste buffer out of get_char, filter Key::Invalid earlier. get_next_key returning Key::Invalid means there was some input but it could not be represented as a Key. An empty optional means there was no input at all.
2023-03-13Merge remote-tracking branch 'krobelus/bracketed-paste'Maxime Coste
2023-03-11Make linewise bracketed paste match P behaviorJohannes Altmanninger
This is experimental. Testing will reveal if this is the desired behavior.
2023-03-11Implement bracketed pasteJohannes Altmanninger
Text pasted into Kakoune's normal mode is interpreted as command sequence, which is probably never what the user wants. Text pasted during insert mode will be inserted fine but may trigger auto-indentation hooks which is likely not what users want. Bracketed paste is pair of escape codes sent by terminals that allow applications to distinguish between pasted text and typed text. Let's use this feature to always insert pasted text verbatim, skipping keymap lookup and the InsertChar hook. In future, we could add a dedicated Paste hook. We need to make a decision on whether to paste before or after the selection. I chose "before" because that's what I'm used to. TerminalUI::set_on_key has EventManager::instance().force_signal(0); I'm not sure if we want the same for TerminalUI::set_on_paste? I assume it doesn't matter because they are always called in tandem. Closes #2465
2023-03-11Make TerminalUI::get_next_key() helpers staticJohannes Altmanninger
The only depend on the TerminalUI object which is a singleton, so we can make them all static.
2023-03-09Merge remote-tracking branch 'potatoalienof13/master'Maxime Coste
2023-03-09Merge remote-tracking branch 'potatoalienof13/i-am-bad-at-git'Maxime Coste
2023-03-01Merge remote-tracking branch 'inahga/aghani-info-width'Maxime Coste
2023-03-01Merge remote-tracking branch 'mujo-hash/master'Maxime Coste
2023-03-01Merge remote-tracking branch 'krobelus/complete-using-param-spec'Maxime Coste
2023-02-28Fix new gcc errors for missing types.ioh
Errors when building with gcc 13: ranked_match.hh:10:21: error: ‘uint64_t’ does not name a type 10 | using UsedLetters = uint64_t; | ^~~~~~~~
2023-02-21Fix fatal exception when checking if buffer needs to be reloadedMaxime Coste
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-19Only decode current codepoint once per stepMaxime Coste
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-19Remove instructions from ExecConfigMaxime Coste
We can just compute whenever we reset last_step, which does not happen often and we know `forward` at compile time anyway
2023-02-19Optimize Regex CharacterClass matchingMaxime Coste
Take advantage of ranges sorting to early out, make the logic inline.
2023-02-17Complete arguments to "echo -to-file"Johannes Altmanninger
Including this here because grandparent parent commit broke completions for "edit -fifo".
2023-02-17Do not complete redundant switchesJohannes Altmanninger
2023-02-17Use parameter parser to skip switch args in completionJohannes Altmanninger
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-15Add option to set maximum info box widthAmeer Ghani
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-15Fix trimming of line front halfway through a double-width glyphMaxime Coste
Insert a space to replace the half glyph and ensure the rest of the line is correctly aligned. Fixes #4843
2023-02-14Fix scroll_window not ensuring cursor lies on a codepoint startMaxime Coste
Fixes #4839
2023-02-14Immediately execute ModuleLoaded hooks for already loaded modulesMaxime Coste
This is trickier than expected because ModuleLoaded hooks can (as any other hooks) use arbitrary regular expressions for their filter. Fixes #4841
2023-02-14Fix broken corner cases in DualThreadStack::grow_ifnMaxime Coste
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-14Refactor DualThreadStack as a RingBufferMaxime Coste
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-13Remove scheduled optimization from ThreadedRegexVMMaxime Coste
This does not seem to actually speed up execution as threads will be dropped on next step anyway
2023-02-10Avoid extra indirection for storing FifoWatcherMaxime Coste
By improving the Value interface we can avoid storing a unique_ptr to a FifoWatcher and directly store the FifoWatcher.
2023-02-03Fix DisplayLine::trim_front quadratic behaviourMaxime Coste
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-01-28Merge remote-tracking branch ↵Maxime Coste
'krobelus/selection-undo-fix-standstill-after-buffer-change'
2023-01-27Merge remote-tracking branch 'occivink/fix-split-stray-sel'Maxime Coste
2023-01-23Fix crash in TabulationHighlighter when wrapping just after a tabMaxime Coste
2023-01-23Fix incorrect use of subject end/begin in regex executionMaxime Coste
This could lead to reading past subject string end in certain conditions Fixes #4794
2023-01-21Revert "Remove compare include that seems to break clang"Maxime Coste
Looks clang breaks differently when this is not included This reverts commit 7030b3c47c7f8c246c1f830631accd226f7a0bbc.
2023-01-21Replace std::strong_ordering with auto return type to not require <compare>Maxime Coste
2023-01-21Remove compare include that seems to break clangMaxime Coste
2023-01-20fix 'split' operation when the pattern occurs at the beginningOlivier Perret
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-18Merge remote-tracking branch 'krobelus/fix-mouse-click-during-insert'Maxime Coste
2023-01-18Merge remote-tracking branch 'potatoalienof13/fix-buffer-advance'Maxime Coste
2023-01-18Merge remote-tracking branch 'krobelus/missing-error-when-open-fails'Maxime Coste
2023-01-08Fix regression when file on command line cannot be openedJohannes Altmanninger
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-08Remove bogus assertions preventing mouse clicks in insert modeJohannes Altmanninger
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.
2022-12-27Make selection undo skip over entries that are nop after buffer changeJohannes Altmanninger
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-27Tweak selection-undo interaction with WinDisplay hooksJohannes Altmanninger
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-27Extract variable and add comment in selection change recordingJohannes Altmanninger
No functional change.
2022-12-27Extract variable in selection undoJohannes Altmanninger
No functional change.
2022-12-27Share logic for undo/redo selection changesJohannes Altmanninger
I will suggest a few changes to this code. No functional change.