Commit Graph

55 Commits

Author SHA1 Message Date
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
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
Maxime Coste
5bba01ca9c BufferManager notify the ClientManager when a buffer dies 2013-03-22 14:26:44 +01:00
Maxime Coste
e5d93c2194 BufferManager: replace Buffer* get_buffer with Buffer& get_buffer 2013-03-21 19:09:31 +01:00
Maxime Coste
8f5be9bf91 BufferManager: registering buffers are front inserted 2012-12-28 13:50:02 +01:00
Maxime Coste
0ce6bd9bf5 use ByteCount instead of CharCount when we are really counting bytes
(that is most of the time when we are not concerned with displaying)
2012-10-11 00:41:48 +02:00
Maxime Coste
f230feec7f Change buffer order based on the last one used 2012-09-28 14:14:49 +02:00
Maxime Coste
f1d8d0add8 escape whitespaces in filename or buffername completions 2012-08-29 21:52:17 +02:00
Maxime Coste
bbce6b22a3 remove regex.hh, define Regex directly in string.hh 2012-08-29 21:49:36 +02:00
Maxime Coste
4cdddb7e6d BufferManager: protect complete_buffername from regex_error 2012-08-28 21:46:49 +02:00
Maxime Coste
e4fd839dda use a strongly typed int CharCount for character counts 2012-08-23 23:56:35 +02:00
Maxime Coste
e00c811712 complete_buffername try regex matching when prefix matching does not work 2012-08-14 14:26:36 +02:00
Maxime Coste
ce99856bfa Refactor BufferManager 2012-08-08 19:36:40 +02:00
Maxime Coste
4dfc910195 BufferManager use safe_ptr to reference the Buffers 2012-06-28 13:45:42 +02:00
Maxime Coste
109c11f29c BufferManager deletes remaining buffers in his destructor 2012-06-14 13:15:30 +00:00
Maxime Coste
9337938403 replace std::string references with String 2012-04-14 01:17:09 +00:00
Maxime Coste
792f0f7f2e BufferManager no longer owns buffers, only register them 2012-03-26 14:21:49 +00:00