diff options
| author | Frank LENORMAND <lenormf@gmail.com> | 2016-07-20 20:45:50 +0300 |
|---|---|---|
| committer | Frank LENORMAND <lenormf@gmail.com> | 2016-07-23 10:03:21 +0300 |
| commit | 8a4596bea9d85c86d03efa129c41530faa2a34a7 (patch) | |
| tree | 8cd6a789c734e8507042fb5126cf692dd3ae789c /src/buffer.hh | |
| parent | 88a9607552fd3c614e6d70a271b663323306a8db (diff) | |
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
Diffstat (limited to 'src/buffer.hh')
| -rw-r--r-- | src/buffer.hh | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/buffer.hh b/src/buffer.hh index 2b118c89..1ed88cf7 100644 --- a/src/buffer.hh +++ b/src/buffer.hh @@ -101,12 +101,13 @@ class Buffer : public SafeCountable, public OptionManagerWatcher, public Scope public: enum class Flags { - None = 0, - File = 1 << 0, - New = 1 << 1, - Fifo = 1 << 2, - NoUndo = 1 << 3, - Debug = 1 << 4 + None = 0, + File = 1 << 0, + New = 1 << 1, + Fifo = 1 << 2, + NoUndo = 1 << 3, + Debug = 1 << 4, + ReadOnly = 1 << 5, }; Buffer(String name, Flags flags, StringView data = {}, |
