summaryrefslogtreecommitdiff
path: root/src/context.cc
AgeCommit message (Collapse)Author
2024-08-12Reduce exposed headers from context.hhMaxime Coste
2024-06-23Fix trailing whitespacesMaxime 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-03-27Add ClientRenamed hookTobias Pisani
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.
2022-09-02Allow to undo and redo selection changesJohannes Altmanninger
From the issue: > It often happens to me that I carefully craft a selection with multiple > cursors, ready to make changes elegantly, only to completely mess it > up by pressing a wrong key (by merging the cursors for example). Being > able to undo the last selection change (even if only until the previous > buffer change) would make this much less painful. Fix this by recording selection changes and allowing simple linear undo/redo of selection changes. The preliminary key bindings are <c-h> and <c-k>. Here are some other vacant normal mode keys I considered X Y <backspace> <minus> # ^ = <plus> ' unfortunately none of them is super convenient to type. Maybe we can kick out some other normal mode command? --- This feature has some overlap with the jump list (<c-o>/<c-i>) and with undo (u) but each of the three features have their moment. Currently there's no special integration with either peer feature; the three histories are completely independent. In future we might want to synchronize them so we can implement Sublime Text's "Soft undo" feature. Note that it is possible to restore selections that predate a buffer modification. Depending on the buffer modification, the selections might look different of course. (When trying to apply an old buffer's selection to the new buffer, Kakoune computes a diff of the buffers and updates the selection accordingly. This works quite well for many practical examples.) This makes us record the full history of all selections for each client. This seems wasteful, we could set a limit. I don't expect excessive memory usage in practice (we also keep the full history of buffer changes) but I could be wrong. Closes #898
2022-08-29Access selections via helper methodsJohannes Altmanninger
The next commit changes the selections to a history of selections. Today we directly access the selections data member. Let's instead use an accessor method, to reduce the number of changes in the next commit.
2021-10-06src: Allow `ga` to skip removed buffersFrank LENORMAND
This commit prevents `ga` from returning a “no last buffer” error when the previously displayed buffer was removed. Since the jumps list keeps track of the order in which buffers were displayed already, handling arbitrary `delete-buffer`s as well, cycle through it to implement `ga` instead of storing a pointer. Note that this commit doesn't take into account buffer flags that might exclude some buffers from being cycled over by commands. Fixes #1840
2019-12-28Redraw relevant clients after adding/removing highlightersMaxime Coste
2019-07-22Ensure current context switches away from buffer on delete-bufferMaxime Coste
Fixes #3025
2019-06-23Use register to store prompt historyMaxime Coste
2019-02-27Fixed all reorder warningsJustin Frank
2019-02-17Collapse jumps based on current index changeMaxime Coste
The previous method, while likely more correct, could restore jump lists containing references to already removed buffers.
2018-09-12Only commit undo groups when buffer was modifiedMaxime Coste
This fixes an interaction with kak-lsp that would trigger undo group commit when setting a buffer option value.
2018-04-07Make FaceRegistry scopedMaxime Coste
set-face now takes a scope argument, and faces can be overridden on a buffer or window basis. colorscheme apply on global scope, which should be good enough for now. Fixes #1411
2018-03-30Support full redraws during shell execution and handle resize thereMaxime Coste
Fixes #1973
2017-12-12Make `edit` command work fine when running from an empty contextMaxime Coste
This way, the kind of context we get from a piped command allows for opening a buffer and working with it directly.
2017-11-13Add count support to jumps (<c-o> and <c-i>). Add jumps testsDelapouite
2017-09-27Add status info when navigating through jumplist (<c-o>, <c-i>)Delapouite
2017-05-22Fix bug where idle timers of disabled modes were still runMaxime Coste
2017-05-13Tweak buffer change code so that WinDisplay hooks can use info boxesMaxime Coste
2017-02-14Make numeric registers setableMaxime Coste
Fixes #1214
2016-10-29Display a status line message when Kakoune is waiting on a shell to completeMaxime Coste
If a shell commands takes more than 1s to execute, a message will appear on the status line notifying the user, along with the time Kakoune has been waiting for.
2016-06-16Clear up info/menus and eventual prompts when reseting to normal modeMaxime Coste
Fixes #697
2016-02-27Remove direct access to ui, go through clientMaxime Coste
Client can now update menu/info positions when the window move around.
2015-12-25Set window dimensions when setting it in a contextMaxime Coste
2015-12-23Remove drop jump (c-d)Maxime Coste
2015-12-23Use an index for jump list current rather than an iteratorMaxime Coste
2015-12-23Extract jump list handling in a JumpList structMaxime Coste
2015-12-22Tweak Context::push_jump implementation, simplify codeMaxime Coste
2015-11-27Support dropping last jump and use it to fix :tag double jump pushMaxime Coste
Fixes #492
2015-08-26Fix segfault in edge case when jumping backwards in jumplistViktor Palmkvist
Closes #380
2015-07-13Move Context scope access helpers as inline methodsMaxime Coste
2015-04-19Make empty context construction more explicitMaxime Coste
2015-04-19Avoid unneeded update of selections when we are going to overwrite themMaxime Coste
2015-04-19Remove Context::set_selections, use Context::selections() = ...Maxime Coste
2015-01-12replace all std::vector with VectorMaxime Coste
2014-12-18Do not register timers for transient input handlersMaxime Coste
2014-11-21Do not reset edition level to 0 on buffer changeMaxime Coste
Keep it as is, commit undo in current buffer, and we will commit it in the new buffer when edition level gets back to 0.
2014-10-30Add scope class and encapsulate Options, Keymaps, Aliases and Hooks in itMaxime Coste
2014-10-30Add scoped aliasesMaxime Coste
aliases are now stored in window, buffer, or globally.
2014-10-10Support changing buffer when an edition is in progressMaxime Coste
2014-06-23Fix crash in Context::main_sel_register_valueMaxime Coste
2014-06-21Use main selection index as default when accessing only one register valueMaxime Coste
Fixes #117
2014-06-05Rework and fix corner cases in selection updating codeMaxime Coste
2014-06-01Add Context::set_selections(std::vector<Selection>)Maxime Coste
This methods avoids updating the context selection needlessly as they are going to get replaced anyway.