summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2024-07-24De-templatize regex selection codeMaxime Coste
This led to lots of duplicated code gen, longer compile time, and most likely unnoticeable performance difference
2024-07-24Merge remote-tracking branch 'JustTaken/view-offset'Maxime Coste
2024-07-22Fix logic to get minimun custom offsetJustTaken
Now the scrolloff can be specified in the configuration file and if either one of the column or line offset given is too large to fit in the buffer, half of the window dimension is taken in it's place. `v<` and `v>` account custom scroll offset as well.
2024-07-22Allow escaping commas in the -buffer argument to eval/execTobias Pisani
I had this issue with device tree binding files in zephyr, that follow the vendor,device.yml convention. The linux kernel presumably uses it as well. While allowing escaping helps, we might consider using a separate option. The most obvious approach might be to move the current behavior to -buffers, and have -buffer be verbatim. However, I'm not entirely sure about the impact of that breakage, so for now, at least the ability to escape it.
2024-07-22Handle word completion when recording macrosMaxime Coste
Make last insert and macro recording closer together, paving the way towards moving last insert to a register. Use a FunctionRef for insert completer key insertion support.
2024-07-20Take in account scrolloff when moving viewportJustTaken
`vt` and `vb` respect custom scroll offset
2024-07-21De-templatize select_objectMaxime Coste
This removes lots of duplicated codegen at the expense of slightly worse constant folding optimizations
2024-07-21Disable UnitTest fully in non KAK_DEBUG buildsMaxime Coste
The code was still compiled and stored in the release executable, this reduces the optimized binary size.
2024-07-19Record macros in repeat last insertMaxime Coste
This fixes an issue with the following hooks: hook global InsertCompletionShow .* %{ map window insert <tab> <c-n> } hook global InsertCompletionHide .* %{ unmap window insert <tab> <c-n> } When repeating a last insert using <tab> to select a completion, it inserts a <tab> instead of selecting, then the insert completion tries to erase the inserted text with backspaces but fails to totally do that as it erases the tab character first.
2024-07-18Bump history max size to 1000Maxime Coste
100 was a bit small for long running sessions.
2024-07-17Clear info box and prompt on pasteMaxime Coste
2024-07-15Improve error message for alternations in lookarounds and add testsMaxime Coste
Fixes #5203
2024-07-01Merge remote-tracking branch 'PJungkamp/directory-changed'Maxime Coste
2024-06-26Fix order of evaluation issue when compiling regex alternationsMaxime Coste
The previous implementation was relying on the left hand side of the assignement's side effects to be sequenced before the right hand side evaluation (so --split_pos was expected to have taken place) This is actually counter to C++17 which guarantees evaluation of the right hand side of the assignement first. For some reason this is not the case with GCC on linux.
2024-06-24Add EnterDirectory hookPhilipp Jungkamp
This hook runs on `change-directory` and is also emitted just before KakBegin after kakrc has been sourced.
2024-06-24Remove some selection copies in pipe and throw early if read onlyMaxime Coste
Throwing early avoids losing selections in this case.
2024-06-23Fix trailing whitespacesMaxime Coste
2024-06-23Allow individual show-whitespace options to be turned offTobias Pisani
This is especially useful to use the indent guides without the other parameters, but in general it can be a useful option. It could be worth considering cleaning up these options to default off instead, but the default also seems useful, so i consider this ok, as it might be the more advanced usecase.
2024-06-15Small code style tweakMaxime Coste
2024-06-15Store instruction pointers directly in ThreadedRegexVM::ThreadMaxime Coste
The previous tradeoff of having a very small Thread struct is not necessary anymore as we do not memcpy Threads on swap_next since d708b77186c1685dcbd2298246ada7d204acec2f. This requires offsets to be used instead of indices for jump/split ops.
2024-06-12Add some static_asserts in SSO codeMaxime Coste
2024-06-11Switch to bitfield.Ben Judd
2024-06-07Fix build by moving include.Ben Judd
2024-06-07Increase SSO from 22 to 23 chars.Ben Judd
2024-06-07Also check shell parameters for kak_* referencesMaxime Coste
This makes it easier to pass shell fragments as arguments so that %sh{ eval "$@" } just works even if arguments refer to Kakoune's vars.
2024-06-05Add <quote> and <dquote> key name aliases.Tobias Pisani
These two can also be annoying to have to escape, so this should make it slightly easier to manage
2024-06-05Echo an information message about *scratch* buffer and leave it emptyMaxime Coste
Having to manually clear the scratch was never really nice and hopefully this will be less annoying and as helpful to newcomers.
2024-05-31Small regex code cleanupMaxime Coste
2024-05-31Add v< and v> to scroll cursor to the leftmost/rightmost columnMaxime Coste
2024-05-29Merge remote-tracking branch 'dontlaugh/debug_mapping_output'Maxime Coste
2024-05-22Add right hand side mapping to "debug mappings"Coleman McFarland
2024-05-18Kakoune 2024.05.18Maxime Coste
2024-05-18Revert "Make TerminalUI::get_next_key() helpers static"Johannes Altmanninger
On macOS, backspace reportedly no longer works after <c-z> and fg. The value of m_original_termios.c_cc[VERASE] seems to be wrong in a static lambda that captures a singleton "this". Not sure what's the problem. I thought that it is guaranteed that "static auto convert = [this]() { ... }" is initialized lazily, hence it should capture the correct address. Maybe the address changes somehow or it's UB / a compiler bug. This reverts commit ad36585b7ad236bea7d1c02b0679ae371c3c2a9e Closes #5155
2024-05-12Handle binary path detection errors on non-/proc platformsChris Webb
On FreeBSD and NetBSD, sysctl() can return -1 when the path is too long, leaving the buffer unitialised. On macOS, both _NSGetExecutablePath() and realpath() can fail with pathological paths or if memory is exhausted. On Haiku, the kak_assert(status == B_OK) check will be compiled out in non-debug builds. Detect all of these cases and error out, reshaping get_kak_binary_path() to avoid multiple repetitions of the same fatal error message.
2024-05-12Fix error handling when reading binary path from /procChris Webb
On Linux, Hurd, Cygwin, DragonFly BSD and Solaris/Illumos, Kakoune obtains a path to its binary by reading the appropriate /proc symlink target. readlink() can fail or it can fill the entire buffer, silently truncating the path if the buffer is too small. kak_assert() is compiled out in non-debug builds so we ignore a readlink() failure, corrupt the stack by writing to buffer[-1] then return a string from the uninitialised buffer. If readlink() succeeds and the binary path is sizeof(buffer) long, we write a \0 terminator beyond its end. If it is longer, we also truncate the path. Throw a fatal error on startup in all these unlikely failure cases.
2024-05-12Fix tests for OpenBSDMaxime Coste
Using the diff provided by @krobelus on #5173 Close #5173
2024-05-09Kakoune 2024.05.09Maxime Coste
2024-04-29Add local scope to user commandsMaxime Coste
2024-04-27Ensure re-used fifo buffers makes that buffer the latest openedMaxime Coste
2024-04-27Add buffer -matching switchMaxime Coste
2024-04-27Don't capture local-scoped faces in promptJohannes Altmanninger
ASan shows that we resolve a face spec owned by a freed stack variable. ================================================================= ==2263300==ERROR: AddressSanitizer: stack-use-after-return on address 0x7a9316c33918 at pc 0x633ea421d8ea bp 0x7ffca001e980 sp 0x7ffca001e970 READ of size 8 at 0x7a9316c33918 thread T0 ... #6 0x633ea421d8e9 in Kakoune::FaceRegistry::resolve_spec(Kakoune::FaceSpec const&) const src/face_registry.cc:128 ... Address 0x7a9316c33918 is located in stack of thread T0 at offset 2328 in frame #0 0x633ea427a095 in operator() src/commands.cc:2267 This frame has 26 object(s): [32, 36) '<unknown>' ... [544, 560) 'disable_hooks' (line 2269) ... [928, 2432) 'local_scope' (line 2271) <== Memory access at offset 2328 is inside this variable
2024-04-19Use a nested command completer for the evaluate-commands commandMaxime Coste
2024-04-19Complete complete-command completer typeMaxime Coste
2024-04-12Introduce "local" scope in evaluate-commandsMaxime Coste
When using `eval` a new scope named 'local' gets pushed for the whole evaluation, this makes it possible to temporarily set an option/hook/alias... Local scopes nest so nested evals do work as expected. Remove the now trivial with-option command
2024-04-12Make removing an unknown highlighter an errorMaxime Coste
Fail instead of silently doing nothing, this makes it easier to toggle highlighters using a try/catch
2024-04-12Rotate through strings when pasting instead of repeating the lastMaxime Coste
This seems like a better overall behaviour. Closes #5135
2024-04-01Add missing <bit> includeMaxime Coste
2024-04-01Fix std::optional used instead of OptionalMaxime Coste
2024-04-01Change mode_info to contain an optional NormalParamsMaxime Coste
As @topisani pointed out in #5131, it is more user friendly to always provide a %val{register} and %val{count} regardless of the mode.
2024-03-31Support exposing some env vars as part of the mode informationMaxime Coste
This should implement what #5131 proposed in a different way. Closes #5131