summaryrefslogtreecommitdiff
path: root/src/buffer_manager.cc
AgeCommit message (Collapse)Author
2025-07-08Replace std::unique_ptr with a custom implementationMaxime Coste
<memory> is a costly header we can avoid by just implementing UniquePtr ourselves, which is a pretty straightforward in modern C++, this saves around 10% of the compilation time here.
2025-07-08Remove uses of Regex in BufferManager by taking a more general filterMaxime Coste
2025-06-03Prevent deletion of buffers while creating new windowsMaxime Coste
`kak -n -E 'hook global WinCreate .* %{ delete-buffer }'` was crashing because we would delete the buffer during window construction, which would not be able to delete the window as it was not fully constructed and registered yet. This led to a window referencing a deleted buffer. Fixing this by deleting the window later on failed because we can enter an infinite loop where we constantly create a new *scratch* buffer, then a window to display it, which deletes that buffer. Make it an error to try to delete a buffer while a new window is being setup by adding a Locked flag to buffers and checking that in BufferManager::delete_buffer Fixes #5311
2025-02-19Cleanup file.cc/hh dependenciesMaxime Coste
file.cc/hh should not know about Context, Buffer, etc... It should be a pretty low level set of helper functions. Move buffer related functions to buffer_utils and extract busy indicators to callers.
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-04-27Ensure re-used fifo buffers makes that buffer the latest openedMaxime Coste
2024-04-27Add buffer -matching switchMaxime Coste
2024-02-28Fix unnecessary buffer line copy in BufferManager::create_bufferMaxime Coste
2024-02-28Templatize StringData::createMaxime Coste
This improves performance by letting the compiler optimize most use cases where string count and length are known are compile time.
2021-05-28Support opening files bigger than 2 GiBMaxime Coste
The real technical limit is with lines bigger than 2 GiB and buffers with more than 2 Gi lines, refactor buffer loading to make it possible to load those files. Fix an overflow with the hash_data function at the same time
2020-02-24Add a new 'arrange-buffers' to let users change the order of the buflistOlivier Perret
2019-11-22Fix crash when deleting buffers in a BufClose hookMaxime Coste
2019-04-12Prevent conversion to client on suspend from disconnecting other clientsMaxime Coste
clear the client manager in the to be converted process without sending exit messages as the forked server will still be there. Fixes #2847
2019-03-19Fix typo in scratch buffer default contentMaxime Coste
2019-03-17Add a text in scratch buffer to make it explicit it wont be savedMaxime Coste
Fixes #2759
2019-02-17Run WinClose hook before putting the window into trashMaxime Coste
2018-05-21Do not reuse m_buffer_trash to store dying buffers in ~BufferManagerMaxime Coste
Doing that clears m_buffer_trash, deleting buffers contained there, but we are not ready to have Buffer destructors running yet as we did not clear the ClientManager, meaning we might have free windows pointing to buffers in the buffer trash.
2018-04-06Make error messages more consistentDelapouite
2018-04-05Add new buffers at the back of the buffer listMaxime Coste
This will be reverted if we discover why we were doing things the over way around. Fixes #1881
2018-03-25Remove contains_that and use any_of to be closer to the c++ stdlibMaxime Coste
2018-02-18BufferManager: Support missing ClientManagerMaxime Coste
2017-08-29Rename containers.hh to ranges.hh (and Container to Range)Maxime Coste
2016-11-29Small cleanup in BufferManager codeMaxime Coste
2016-10-13Always allow to delete a buffer, just recreate a scratch buffer if neededMaxime Coste
Fixes #850
2016-10-11Only create a default *scratch* when we dont have any non debug buffersMaxime Coste
Fixes #852 Closes #856
2016-10-10Convert some uses of lambda to more concise std::mem_fnMaxime Coste
2016-07-24Merge remote-tracking branch 'lenormf/readonly-mode'Maxime Coste
2016-07-24Replace C-style operators with their alphabetical equivalentFrank LENORMAND
2016-07-23Implement a `readonly` modeFrank LENORMAND
This commit introduces the `readonly` variable as well as the `-ro` command line option which prevent buffers from being overwritten on disk when the `write` command is used without arguments. Some buffers can selectively be put in readonly mode by setting the `readonly` variable on the `buffer` scope, the `global` mode will affect all buffers (even those who will be open subsequently), using the `window` scope will have no effect. Closes #685
2016-07-10Ensure buffer create/close hooks are run at appropriate timesMaxime Coste
They used to be ran before the buffer was added to the buffer list we now run them afterwards.
2016-07-04Avoid possible access to an invalid, being deleted buffer list.Maxime Coste
2016-05-15Fix duplicate buffer problem, fix real_path beahviourMaxime Coste
2016-05-14BufferManager now owns the Buffers instead of registering themMaxime Coste
2016-05-14Delay window deletion until we get back to main loopMaxime Coste
Avoid WinResize hooks while redrawing, ensure window resize only take place while handling user input. Fixes #672
2016-03-03destroy buffer manager first but clear clients before destroying buffers.Maxime Coste
Fixes #612
2016-03-02BufferManager should outlive ClientManager in the endMaxime Coste
If not, clients end up keeping references on a buffer while it it being deleted.
2016-03-02Ensure ClientManager is always outliving the BufferManagerMaxime Coste
2015-11-07Store the last used buffer in clientsMaxime Coste
Fixes #474
2015-09-08Tweak BufferManager::delete_buffer implementationMaxime Coste
2015-08-06ensure a buffer is not referenced a second time, just before actually ↵Maxime Coste
deleting it It can happen in certain case that a buffer gets referenced after it gets moved to the trash, for example when it gets deleted during its construction (due to BufCreate hook for example).
2015-07-08Gracefully handle exception when opening files given on command lineMaxime Coste
Fixes #310
2015-06-01Port more code to use the format function instead of adhoc string concatMaxime Coste
2015-04-23Fix :open bug that could set a deleted buffer as the last used oneMaxime Coste
2015-03-12Avoid calling real_path when not needed in BufferManager::get_buffer_ifpMaxime Coste
2015-02-23Use RefPtr as SafePtr backendMaxime Coste
2015-01-26Try to improve ga behaviourMaxime Coste
2014-12-23Extract complete_buffer_name as a free function in commands.ccMaxime Coste
2014-12-23Unify completion from container content logicMaxime Coste
2014-10-13Do not assert on SIGTERM and backup modified buffers on signal induced ↵Maxime Coste
termination
2014-08-18Do not escape completions in completer functions let the client decideMaxime Coste
Fixes #231