summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2022-07-18Improve readability of debug memory command outputMaxime Coste
Group memory usage digits with commas to make it easier to read those numbers.
2022-07-13Re-work line trimming to fix issues with column highightersMaxime Coste
Instead of triming only buffer ranges, add a trim_from method to display line to keep the initial N columns, we know how many columns are used by non-trimable widgets in DisplaySetup::widget_columns so we can just pass this. Also restore the previous logic for face merging Fixes #4670
2022-07-12Fix past-the-eol column highlighter getting highlighted as buffer rangeMaxime Coste
Make the column highlighter faces final, and change final logic to give precedence to the base face when both the base and new face are final. Fixes #4669
2022-07-11Fix buffer location of column highlighter's past-eol atomsMaxime Coste
Using buffer end was confusing Window::display_position that assumes display atom buffer locations are always increasing.
2022-07-10Make Shift+Backspace erase a character in insert modeJohannes Altmanninger
Terminals that support CSI u escape codes (like iTerm2, Kitty and foot) allow us to map <s-backspace> independently of <backspace>. Users expect that <s-backspace> does the same as <backspace>, especially when typing ALL_CAPS. Make it so. The first version of 0cf719103 (Make Shift+Space insert a space in insert mode, 2022-02-09) did that already but I later dropped it because I wasn't sure if it's right.
2022-07-10Merge branch 'roam-murmurhash-endian' of http://github.com/ppentchev/kakouneMaxime Coste
2022-07-10Refactor highlighting logicMaxime Coste
Always start with full buffer lines and trim the display buffer at the very end, treat non-range display atoms as non-trimable in that case and keep track of how many columns are occupied by "widgets" such as line numbers or flags. Fixes #4659
2022-07-07murmurhash: always load byte by bytePeter Pentchev
Also reverse the order of bytes, loading the most significant parts first, and use bitwise "or" instead of addition.
2022-07-05Remove <esc> as end macro recording, Q should be enoughMaxime Coste
Besides being redundant, it is easy to press esc by mistake/habit while recording a macro.
2022-07-05Distinguish between non-eol max column target and plain max columnMaxime Coste
2022-07-05Store HistoryRegisters with most recent entry in frontMaxime Coste
Closes #3105
2022-07-05Move user mappings to <space> and keep/remove selection to ,Maxime Coste
2022-07-05Select pasted text on pasteMaxime Coste
This is more consistent with the recently changed ! and <a-!> behaviour
2022-07-05Make `x` just select the full linesMaxime Coste
`x` is often criticized as hard to predict due to its slightly complex behaviour of selecting next line if the current one is fully selected. Change `x` to use the previous `<a-x>` behaviour, and change `<a-x>` to trim to fully selected lines as `<a-X>` did. Adapt existing indentation script to the new behaviour
2022-06-30Merge remote-tracking branch 'krobelus/escape-xmessage-args'Maxime Coste
2022-06-30Insert all register values in prompt after <c-r> when Alt-modifiedMaxime Coste
`<c-r><a-.>` will insert all selections joined by space instead of only the main one as `<c-r>.` would.
2022-06-26Escape message before running xmessage in a shellJohannes Altmanninger
2022-06-24Fix murmurhash for big-endian architectures.Peter Pentchev
The murmurhash implementation tries to read a sequence of four bytes as a single little-endian uint32 value. This does not work on e.g. Linux/s390x; https://buildd.debian.org/status/fetch.php?pkg=kakoune&arch=s390x&ver=2021.11.08-1&stamp=1645975425&raw=0
2022-06-14Merge remote-tracking branch 'krobelus/clean-version-object'Maxime Coste
2022-06-07Filter empty entries when restoring HistoryRegistersMaxime Coste
Saving registers will create a single empty entry due to the way StaticRegister::get works. We do not really want those to be restored
2022-06-04Merge remote-tracking branch 'krobelus/shift-space'Maxime Coste
2022-06-04Merge remote-tracking branch 'krobelus/replace-std-iterator'Maxime Coste
2022-06-04Code style cleanups around insert completerMaxime Coste
2022-06-04Merge remote-tracking branch 'krobelus/track-inserted-completions-better'Maxime Coste
2022-06-03Only set fd to non-block if there is an EventManagerMaxime Coste
Fixes #4630
2022-05-30Fix switch completionMaxime Coste
2022-05-29Run InsertCompletionHide hook before insertions that close completion menuJohannes Altmanninger
Insert mode completions are accepted by typing any key. For example, if there is a completion "somefunction()", then typing some<c-n>; will insert somefunction(); and then the InsertCompletionHide hook will fire. The hook parameter is a range that contains the entire thing: the actual completion plus the trailing semicolon that closed the completion menu. The [original motivation] for the hook parameter was to support removing text inserted by completion, so we can apply text edits or expand snippets instead. One problem is that we don't want to remove the semicolon. Another problem came up in a discussion about [snippets]: let's say we have a snippet "add" that expands to add(?, ?) where ? are placeholders. After snippet expansion the cursor replaces the first placeholder. If I type "ad<c-n>1" I expect to get "add(1, ?)". If the InsertCompletionHide hook only runs after processing the "1" keystroke, this is not possible without evil hacks. Fix these problems by running InsertCompletionHide when a completion is accepted _before_ inserting anything else into the buffer. This should make it much easier to fully implement [LSP text edits]. I doubt that anyone besides kak-lsp is using the hook parameter today so this should be a low-risk fix. [original motivation]: https://github.com/mawww/kakoune/issues/2898 [snippets]: https://github.com/kak-lsp/kak-lsp/pull/616#discussion_r883208858 [LSP text edits]: https://github.com/kak-lsp/kak-lsp/issues/40
2022-05-29make clean: also clean up generated version filesJohannes Altmanninger
We also discussed using "git clean -dXf" but that could remove files that were not generated by make. Closes #4619
2022-05-26Filter out switches when completing commandsMaxime Coste
Fixes #4625 Fixes #4209 Fixes #4040
2022-05-26Fix indent commands not being committed as an undo groupMaxime Coste
2edabde9193d301ed0db14ac967d8b5503af7d8c removed the ScopedEdition that took care of committing the undo group after indenting operations.
2022-05-21Stop using deprecated std::iteratorJohannes Altmanninger
As reported in #4615 and others, GCC 12.1 emits deprecation warnings because we use std::iterator. Replace it with the modern equivalent. Closes #4615
2022-05-20Simplify Buffer::do_insert and Buffer::do_eraseMaxime Coste
2022-05-10Run EventManager whenever writing to a file descriptor would blockMaxime Coste
This approach is not very elegant as it hooks into the event manager deep inside the call graph, but solves the exiting issue and is an okay stop gap solution until a better design comes up. Fixes #4605
2022-05-08Work around incomplete std::to_chars() support in libstdc++ 10Johannes Altmanninger
Ubuntu 20.04 ships GCC's libstdc++ 10 from 2020 which implements std::to_chars() for integers but not for floats. Use the float overload only if the library advertises support via the feature testing macro. This can be removed once we require GCC 11 (see https://www.gnu.org/software/gcc/gcc-11/changes.html). Closes #4607
2022-05-05Fix parsing of INT_MIN %argMaxime Coste
Fixes #4601
2022-05-05Use std::to_chars to int to str conversionMaxime Coste
2022-05-01Remove invalid assert in ScopedForceNormal destructorMaxime Coste
commit 90db664635013f6e857ec696403f2164032410a8 introduced logic to handle the case where the mode had been removed, but did not get rid of the assert.
2022-04-28Fix compilation due to failing template deduction for aggregatesJohannes Altmanninger
gcc 11.2.0 compiles us just fine but clang 13.0.1 fails with this error clang++ -DKAK_DEBUG -O0 -pedantic -std=c++2a -g -Wall -Wextra -Wno-unused-parameter -Wno-sign-compare -Wno-address -frelaxed-template-template-args -Wno-ambiguous-reversed-operator -MD -MP -MF .ranges.debug.d -c -o .ranges.debug.o ranges.cc ranges.cc:30:17: error: no viable constructor or deduction guide for deduction of template arguments of 'Array' check_equal(Array{{""_sv, "abc"_sv, ""_sv, "def"_sv, ""_sv}} | flatten(), "abcdef"_sv); ^ ./constexpr_utils.hh:14:8: note: candidate template ignored: couldn't infer template argument 'T' struct Array ^ ./constexpr_utils.hh:14:8: note: candidate function template not viable: requires 0 arguments, but 1 was provided 1 error generated. The same error can be reproduced with this C++ input template<typename T, int N> struct Array { T m_data[N]; }; void test() { (void)Array{{1, 2}}; } Since "Array" has no constructor, the compiler uses aggregate initialization. Only recent g++ seems to be smart enough to deduce template arguments in this case. Help other compilers by adding a deduction guide. The deduction guide needs to count the array elements to infer the array size, hence we need to remove braces. Happily, this is allowed and it's also what std::array does. Closes #4597
2022-04-25Introduce a flatten range adapter and use it in execute_keys_cmdMaxime Coste
This avoids allocating a KeyList vector in which to flatten all the different arguments and simplifies the client logic.
2022-04-16Make Shift+Space insert a space in insert modeJohannes Altmanninger
Terminals that support CSI u escape codes (like iTerm2, Kitty and foot) allow us to map <s-space> independently of <space>. Users expect that <s-space> inputs a space character; make it so. Fixes #4534 Also reported in https://discuss.kakoune.com/t/shift-space-doesnt-send-space-character/2004
2022-04-12Fix crash when deleting a buffer from a user mappingMaxime Coste
Deleting a buffer resets normal mode on all clients that were displaing that buffer, but ScopedForceNormalMode that are used from user mode do not take this possiblity into account on destruction, which leads to deleting the last normal mode from the context, ending up with an empty mode stack. Fixes #3909
2022-04-11Merge remote-tracking branch 'Screwtapello/cleanup-session-name-validation'Maxime Coste
2022-04-11Code style cleanups around object selection codeMaxime Coste
2022-04-07Check for buffer overflow when constructing the socket path.Tim Allen
2022-04-07Do all session name validation in session_path().Tim Allen
2022-03-08Fix buffer overflow in parse_quotedtomKPZ
This fixes a crash when using kak-lsp with bash-language-server. The issue is that the second read() in parse_quoted may read past the end of the string. If this happens and the condition on line 126 is false, then the loop on line 119 will continue to read past the end of the buffer since it checks for state.pos != end instead of state.pos < end, which will likely result in a crash. The fix is to add a check for the buffer end before the second read. The added test fails without the change and passes with the change.
2022-03-06Document ! and <a-!> breaking changeMaxime Coste
2022-03-06src: Select the data inserted by `!` and `<a-!>`Frank LENORMAND
Closes #1468
2022-03-06Add a complete-command command to configure command completionMaxime Coste
This makes it possible to change command completion in hooks and paves the way to more flexibility in how custom commands can be completed
2022-03-06Close MappedFile fd using on_scope_end to handle all return pathsMaxime Coste