Commit Graph

70 Commits

Author SHA1 Message Date
Maxime Coste
f87e844244 Add a text in scratch buffer to make it explicit it wont be saved
Fixes #2759
2019-03-17 10:41:11 +11:00
Maxime Coste
8135a44c6c Run WinClose hook before putting the window into trash 2019-02-17 11:21:26 +11:00
Maxime Coste
56e2174cf6 Do not reuse m_buffer_trash to store dying buffers in ~BufferManager
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-05-21 20:30:24 +10:00
Delapouite
cb02186c77 Make error messages more consistent 2018-04-06 16:56:53 +02:00
Maxime Coste
21603983c5 Add new buffers at the back of the buffer list
This will be reverted if we discover why we were doing things the
over way around.

Fixes #1881
2018-04-05 10:31:41 +10:00
Maxime Coste
49c52b025f Remove contains_that and use any_of to be closer to the c++ stdlib 2018-03-25 16:47:19 +11:00
Maxime Coste
d9cddf41f2 BufferManager: Support missing ClientManager 2018-02-18 14:50:24 +11:00
Maxime Coste
ab6a999431 Rename containers.hh to ranges.hh (and Container to Range) 2017-08-29 15:23:03 +07:00
Maxime Coste
db86c6cbc9 Small cleanup in BufferManager code 2016-11-29 19:12:10 +00:00
Maxime Coste
cc2affea11 Always allow to delete a buffer, just recreate a scratch buffer if needed
Fixes #850
2016-10-13 21:37:44 +01:00
Maxime Coste
5440d31f99 Only create a default *scratch* when we dont have any non debug buffers
Fixes #852
Closes #856
2016-10-11 00:45:05 +01:00
Maxime Coste
025b91baca Convert some uses of lambda to more concise std::mem_fn 2016-10-10 23:44:18 +01:00
Maxime Coste
003cb8dfea Merge remote-tracking branch 'lenormf/readonly-mode' 2016-07-24 21:21:49 +01:00
Frank LENORMAND
e3bf01d1f9 Replace C-style operators with their alphabetical equivalent 2016-07-24 08:34:49 +03:00
Frank LENORMAND
8a4596bea9 Implement a readonly mode
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-23 10:03:21 +03:00
Maxime Coste
530ecf212e Ensure buffer create/close hooks are run at appropriate times
They used to be ran before the buffer was added to the buffer list
we now run them afterwards.
2016-07-10 16:34:16 +01:00
Maxime Coste
469eb6ec44 Avoid possible access to an invalid, being deleted buffer list. 2016-07-04 19:20:22 +01:00
Maxime Coste
baf219ee2f Fix duplicate buffer problem, fix real_path beahviour 2016-05-15 10:37:01 +01:00
Maxime Coste
1788126f38 BufferManager now owns the Buffers instead of registering them 2016-05-14 08:33:50 +01:00
Maxime Coste
ba421e45f7 Delay window deletion until we get back to main loop
Avoid WinResize hooks while redrawing, ensure window resize only
take place while handling user input.

Fixes #672
2016-05-14 08:17:52 +01:00
Maxime Coste
b5b5b82c70 destroy buffer manager first but clear clients before destroying buffers.
Fixes #612
2016-03-03 14:05:07 +00:00
Maxime Coste
67849f2db7 BufferManager should outlive ClientManager in the end
If not, clients end up keeping references on a buffer while
it it being deleted.
2016-03-02 20:27:47 +00:00
Maxime Coste
72dc8e6774 Ensure ClientManager is always outliving the BufferManager 2016-03-02 13:30:11 +00:00
Maxime Coste
6840f7ce9c Store the last used buffer in clients
Fixes #474
2015-11-07 18:25:49 +00:00
Maxime Coste
182cc368a0 Tweak BufferManager::delete_buffer implementation 2015-09-08 13:10:22 +01:00
Maxime Coste
7a59a6d758 ensure a buffer is not referenced a second time, just before actually 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-08-06 21:51:44 +01:00
Maxime Coste
123541822b Gracefully handle exception when opening files given on command line
Fixes #310
2015-07-08 13:43:40 +01:00
Maxime Coste
f19bb4fe6d Port more code to use the format function instead of adhoc string concat 2015-06-01 19:06:35 +01:00
Maxime Coste
d6b69cb6f7 Fix :open bug that could set a deleted buffer as the last used one 2015-04-23 20:15:17 +01:00
Maxime Coste
d9cd5fef8f Avoid calling real_path when not needed in BufferManager::get_buffer_ifp 2015-03-12 19:40:10 +00:00
Maxime Coste
0a6901899d Use RefPtr as SafePtr backend 2015-02-23 20:39:56 +00:00
Maxime Coste
92cb3a035f Try to improve ga behaviour 2015-01-26 19:40:48 +00:00
Maxime Coste
ed54e102ee Extract complete_buffer_name as a free function in commands.cc 2014-12-23 17:42:17 +00:00
Maxime Coste
b6ff15aa75 Unify completion from container content logic 2014-12-23 13:54:09 +00:00
Maxime Coste
2adaa7bdfa Do not assert on SIGTERM and backup modified buffers on signal induced termination 2014-10-13 13:38:28 +01:00
Maxime Coste
2e2812b10f Do not escape completions in completer functions let the client decide
Fixes #231
2014-08-18 23:31:02 +01:00
Maxime Coste
2204b7cf06 Defer deletion of buffers to after the event loop
We can have SelectionList in flights on the buffer, so mark
it for deletion by moving it in a buffer trash, and effectively
delete it later, at a point where there should not be any further
access to it.
2014-08-12 19:24:09 +01:00
Maxime Coste
de402c4703 Fix buffer name completion when basename only 2014-08-03 10:00:34 +01:00
Maxime Coste
aac02410b1 Buffer completion match directory names as well for subsequence match 2014-07-31 22:43:36 +01:00
Maxime Coste
b2123547df Use StringView in BufferManager 2014-04-19 09:53:37 +01:00
Maxime Coste
adde2fef75 Use StringView for completion functions 2014-04-18 14:02:14 +01:00
Maxime Coste
a9b3a8b0d6 rename BufferManager::complete_buffername to complete_buffer_name 2014-04-07 23:47:50 +01:00
Maxime Coste
bc1d1ba59f Fix warnings 2013-11-10 22:51:52 +00:00
Maxime Coste
b080f456a7 Do not take directories into account when completing buffer name
(except if a / is found in the completion prefix)
2013-09-25 18:59:03 +01:00
Maxime Coste
9018bc47df use subsequence instead of regex matching for buffer completion 2013-09-24 10:13:39 +02:00
Maxime Coste
5ae43acf94 Add prefix_match function and use it instead of adhoc code 2013-09-23 21:16:25 +02:00
Maxime Coste
9999e5698d Use the buffer manager to delete buffer, throw when a client is inserting 2013-04-10 18:54:01 +02:00
Maxime Coste
270e950cf1 sort includes directives 2013-04-09 20:05:40 +02:00
Maxime Coste
5adee4a6a7 rename assert to kak_assert to avoid collisions 2013-04-09 20:04:11 +02:00
Maxime Coste
9429b662ca move absolute path logic to Buffer class 2013-03-25 19:58:23 +01:00